dotnet/roslyn

SemanticModel.GetDeclaredSymbol doesn't return the getter symbol for C# expression bodied property initializer

Open

#1,060 opened on Mar 5, 2015

View on GitHub
 (2 comments) (0 reactions) (0 assignees)C# (4,257 forks)batch import
Area-CompilersBugConcept-APILanguage-C#help wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (Avg merge 6d 17h) (256 merged PRs in 30d)

Description

None of the descendant nodes of expression bodied property in C# returns the getter method symbol for that property when GetDeclaredSymbol is invoked on them. This seems wrong as the getter method symbol has IsImplicityDeclared = false, and also has its declaring syntax node as the ArrowExpressionClauseSyntax.

I think we want to handle GetDeclaredSymbol(ArrowExpressionClauseSyntax) to return the property getter if the given arrow expression is parented by a BasePropertyDeclarationSyntax.

Contributor guide