Better parse when lambda expressions contain default parameter values.#58690
Better parse when lambda expressions contain default parameter values.#58690CyrusNajmabadi merged 22 commits intodotnet:mainfrom
Conversation
|
@RikkiGibson this is ready for review. |
| // it. However, that should never happen as ScanParenthesizedLambda allows `!!` only. | ||
| Debug.Assert(equalsToken == null); | ||
| // If we didn't already consume an equals sign as part of !!=, then try to scan one out now. Note: this is | ||
| // not legal code. But we detect it so that we can give the user a good message, and so we don't completely |
|
@dotnet/roslyn-compiler for a second review on a relatively simple change |
|
@dotnet/roslyn-compiler for small parser change that produces better error recovery results. thanks! |
| // This allows us to handle this code without ever showing it the binding phases. We could consider | ||
| // actually binding this in the future if it would be helpful and if we're ok paying the testing cost of | ||
| // checking this at the semantic layers. |
There was a problem hiding this comment.
Consider dropping the end of the comment - we typically bind code the user wrote, even in error situations, so the cost shouldn't be an issue.
| // This allows us to handle this code without ever showing it the binding phases. We could consider | |
| // actually binding this in the future if it would be helpful and if we're ok paying the testing cost of | |
| // checking this at the semantic layers. | |
| // This allows us to handle this code without showing it to the binding phases. We could consider | |
| // actually binding this in the future. |
There was a problem hiding this comment.
so the cost shouldn't be an issue.
In this case, i mentioned that it's "testing cost" :) In other words, i'd like to have the better error recovery here, but i don't really want to write the tons of semantic tests that validate this :)
I'm not sure it's worth handling Refers to: src/Compilers/CSharp/Portable/Parser/LanguageParser.cs:4395 in 0613817. [](commit_id = 0613817, deletion_comment = True) |
Co-authored-by: Charles Stoner <10732005+cston@users.noreply.github.com>
It didn't bother me to support. I'm a fan of the parser not going off the rails for sensible constructs. I do agree it's exceedingly unlikely for this code to happen though (who even uses __arglist), so i can revert this though if you'd like. :) |
Followup to #58644