-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve location that lambda errors are reported at. #69334
Improve location that lambda errors are reported at. #69334
Conversation
@dotnet/roslyn-compiler this is ready for review. |
IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: '(int i) => { }') | ||
IBlockOperation (0 statements) (OperationKind.Block, Type: null, IsInvalid) (Syntax: '{ }') | ||
IBlockOperation (0 statements) (OperationKind.Block, Type: null) (Syntax: '{ }') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't follow, what caused the IOperation changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iop adds the isinvalid bit if the node overlaps a semantic diagnostic. Because the diagnostic got smaller, less nodes are marked as invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :-) Done with review pass (iteration 14). Only minor questions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks (iteration 18)
@dotnet/roslyn-compiler for a second pair of eyes. Thanks! |
Fixes #69322
This changes the place we report lambda/anonymous-delegate errors to be on the
=>
anddelegate
token of each construct respectively, instead of reporting the error on the entire expression.Lambdas are effectively unbounded in size, and reporting such a large error is both poor for the user experience (as it can squiggle a huge range of the buffer), it also often masks more important issues for the user to be aware of (like the actual error in the parameters or body that is causing the high level lambda problem).