-
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
Improved error recovery for lambdas in a call with extra arguments. #11807
Conversation
|
||
// We expect that we have been handed a list of arguments and a list of the | ||
// formal parameter types they correspond to; all the details about named and | ||
// optional parameters have already been dealt with. | ||
|
||
// SPEC: For each of the method arguments Ei: | ||
for (int arg = 0; arg < _arguments.Length; arg++) | ||
var length = this.Length; | ||
for (int arg = 0; arg < length; arg++) |
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.
a common idiom for this is: for (int arg = 0, n = this.Length; i < n; i++)
aa8f581
to
567d12f
Compare
Test failure reported in #11818 |
/// For error recovery, we allow a mismatch between the number of arguments and parameters | ||
/// during type inference. This sometimes enables inferring the type for a lambda parameter. | ||
/// </summary> | ||
private int Length => System.Math.Min(_arguments.Length, _formalParameterTypes.Length); |
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.
Can we name this something more descriptive?
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.
Suggestion?
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've revised this PR, adding a test for non-syntax-error scenario, and renaming a property. Pleas review revision. |
👍 |
LGTM |
@dotnet-bot retest windows_eta_open_prtest please |
Fixes #557, #5498
@dotnet/roslyn-compiler Please review
@CyrusNajmabadi FYI