dotnet/roslyn

`SemanticModel.GetSymbolInfo` doesn't return a symbol for `FunctionPointerUnmanagedCallingConventionSyntax`

オープン

#59,060 opened on 2022/01/25

 (6 件のコメント) (0 件のリアクション) (0 人の担当者)C# (4,257 件のフォーク)batch import
Area-CompilersFeature - Function Pointershelp wanted

Repository metrics

Stars
 (20,414 個のスター)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

Version Used:

main

Steps to Reproduce:

Invoke GetSymbolInfo on a FunctionPointerUnmanagedCallingConventionSyntax, eg:

            CSharpCompilation comp = CSharpCompilation.Create("MyAssembly", new[] { SyntaxFactory.ParseSyntaxTree(@"
public unsafe class C
{
    delegate* unmanaged[MemberFunction]<void> f;
}") });
            var tree = comp.SyntaxTrees[0];
            var model = comp.GetSemanticModel(tree);
            var node = tree.GetRoot().DescendantNodes().Where(node => node is FunctionPointerUnmanagedCallingConventionSyntax).Single();
            var info = model.GetSymbolInfo(node); // info.Symbol is null.

Expected Behavior:

The type symbol for System.Runtime.CompilerServices.CallConvMemberFunction

Actual Behavior:

Null symbol

https://github.com/dotnet/roslyn/blob/7cfc9e70afd641bb7b6bb29ae502049f25dc42a3/src/Compilers/CSharp/Portable/Compilation/CSharpSemanticModel.cs#L4899-L4924

コントリビューターガイド