Skip to content

Put record parameters in scope withing instance initializers#44906

Merged
jcouv merged 5 commits intodotnet:features/recordsfrom
AlekseyTs:Records_04
Jun 6, 2020
Merged

Put record parameters in scope withing instance initializers#44906
jcouv merged 5 commits intodotnet:features/recordsfrom
AlekseyTs:Records_04

Conversation

@AlekseyTs
Copy link
Contributor

@AlekseyTs
Copy link
Contributor Author

@agocke, @RikkiGibson, @cston, @jcouv, @dotnet/roslyn-compiler Please review, need a second sign-off, the amount of changes is small.

);

TestLookupNames(text, expectedNames);
}
Copy link
Contributor

@cston cston Jun 6, 2020

Choose a reason for hiding this comment

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

Consider testing a const field as well. #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider testing a const field as well.

Const fields are static fields, so I am pretty confident this test is fairly equivalent to verify scoping rules. I will add a test like that for completeness sake in a separate PR


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

Assert.Equal("System.Int32 C.Z", model.GetEnclosingSymbol(x.SpanStart).ToTestDisplayString());
Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X"));
Assert.Contains("X", model.LookupNames(x.SpanStart));
}
Copy link
Contributor

@cston cston Jun 6, 2020

Choose a reason for hiding this comment

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

Consider testing capturing:

record C(int X)
{
    Func<int> F = () => X;
}
``` #Resolved

@jcouv
Copy link
Member

jcouv commented Jun 6, 2020

FYI, resolved conflicts following Chuck's PR.

@RikkiGibson
Copy link
Member

@jcouv there are analyzer diagnostics in the Correctness run.

@jcouv jcouv merged commit a646747 into dotnet:features/records Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants