Skip to content

MemberSemanticModel - special case binding CompilationUnit for a simple program.#58527

Merged
AlekseyTs merged 2 commits intodotnet:mainfrom
AlekseyTs:Issue58521
Dec 30, 2021
Merged

MemberSemanticModel - special case binding CompilationUnit for a simple program.#58527
AlekseyTs merged 2 commits intodotnet:mainfrom
AlekseyTs:Issue58521

Conversation

@AlekseyTs
Copy link
Copy Markdown
Contributor

Fixes #58521.

@AlekseyTs AlekseyTs requested a review from a team as a code owner December 29, 2021 23:35
@AlekseyTs
Copy link
Copy Markdown
Contributor Author

@dotnet/roslyn-compiler For a second review for a small fix.

var tree = compilation.SyntaxTrees[0];
var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var");
var model = compilation.GetSemanticModel(tree);
var anonymousType = model.GetSymbolInfo(identifier).Symbol.GetSymbol<TypeSymbol>();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

anonymousType

This value is unused.


[Fact]
[WorkItem(58521, "https://github.com/dotnet/roslyn/issues/58521")]
public void Issue58521()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Issue58521

Consider giving a descriptive name.

@AlekseyTs AlekseyTs enabled auto-merge (squash) December 29, 2021 23:54
@AlekseyTs AlekseyTs merged commit 78f0ba5 into dotnet:main Dec 30, 2021
@ghost ghost added this to the Next milestone Dec 30, 2021
@Cosifne Cosifne modified the milestones: Next, 17.1.P3 Jan 5, 2022
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.

System.InvalidCastException when SemanticModel attempts to bind simple program with a local function as the first statement

4 participants