Skip to content

Have compiler return semantic errors in incomplete members. #7536

Open
@CyrusNajmabadi

Description

This is similar to #1867

Examples where we want semantic errors:

class C {
    Directory     //<-- want errors on Directory
    private int i; 
}

class Program {
    Func < FlowControl x    // <-- on both 'Func' and 'FlowControl'
} 

class C {
  [Extension]   //<-- in an attribute on nothing
} 

Note: i handled this in TypeScript by not even having the concept of an "Incomplete Member". If no existing member rule could parse out the text, then we fell back to "Field". This meant that we would properly consume the modifiers, attribute and type, and we'd give proper messages for when anything was missing.

By then being a field, all the remaining parts of the compiler just lit up and worked properly.

This is something we could consider doing in the C# compiler as well. (or we could just make it so that it binds Incomplete Members).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions