dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.08k stars 4.04k forks source link

Microsoft.CodeAnalysis.VisualBasic.SymbolDisplay.ToDisplayString() does not include ByRef for C# ParameterSymbols #14683

Open cston opened 8 years ago

cston commented 8 years ago

Microsoft.CodeAnalysis.VisualBasic.SymbolDisplay.ToDisplayString() returns F(Integer) rather than F(ByRef Integer) for:

class C
{
    void F(ref int i) { }
}

See Microsoft.CodeAnalysis.VisualBasic.UnitTests.SymbolDisplayTests.RefReturn.

AlekseyTs commented 1 year ago

It looks like we are casing to VB specific symbol in this helper:

        Private Function IsExplicitByRefParameter(parameter As IParameterSymbol) As Boolean
            Dim vbParameter = TryCast(parameter, ParameterSymbol)
            Return vbParameter IsNot Nothing AndAlso vbParameter.IsExplicitByRef
        End Function