Skip to content
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

Merged
merged 3 commits into from
Jun 13, 2016

Conversation

gafter
Copy link
Member

@gafter gafter commented Jun 7, 2016

Fixes #557, #5498

@dotnet/roslyn-compiler Please review
@CyrusNajmabadi FYI

@gafter gafter added Bug Area-Compilers 4 - In Review A fix for the issue is submitted for review. labels Jun 7, 2016
@gafter gafter added this to the 2.0 (Preview 3) milestone Jun 7, 2016
@gafter gafter self-assigned this Jun 7, 2016

// 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++)
Copy link
Member

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++)

@gafter
Copy link
Member Author

gafter commented Jun 7, 2016

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);
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AmountOfArgumentsToConsider?


In reply to: 66173546 [](ancestors = 66173546)

@gafter
Copy link
Member Author

gafter commented Jun 9, 2016

I've revised this PR, adding a test for non-syntax-error scenario, and renaming a property. Pleas review revision.

@agocke
Copy link
Member

agocke commented Jun 9, 2016

👍

@AlekseyTs
Copy link
Contributor

LGTM

@gafter
Copy link
Member Author

gafter commented Jun 13, 2016

@dotnet-bot retest windows_eta_open_prtest please
// Previous failure: http://dotnet-ci.cloudapp.net/job/Private/job/dotnet_roslyn-internal/job/master/job/windows_eta_open_prtest/319/
// Retest reason:

@gafter gafter merged commit d19ec6f into dotnet:master Jun 13, 2016
@gafter gafter deleted the master-errlambda04 branch May 24, 2018 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - In Review A fix for the issue is submitted for review. Area-Compilers Bug cla-already-signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants