Roslyn: CommonConversion in VB always set to default value

Created on 11 Aug 2017  路  2Comments  路  Source: dotnet/roslyn

It seems IConversionExpression.Conversion in VB always returns default value.

Foe example, with code below, there should be a numeric conversion.

Class Program
    Sub M1()
        Dim x = 1.0
        M2(x)'BIND:"M2(x)"
    End Sub

    Sub M2(a As Integer)
    End Sub
End Class
IInvocationExpression ( Sub Program.M2(a As System.Int32)) (OperationKind.InvocationExpression, Type: System.Void) (Syntax: 'M2(x)')
        Instance Receiver: IInstanceReferenceExpression (InstanceReferenceKind.Implicit) (OperationKind.InstanceReferenceExpression, Type: Program) (Syntax: 'M2')
        Arguments(1):
            IArgument (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument) (Syntax: 'x')
              IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Int32) (Syntax: 'x')
                Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
                Operand: ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: System.Double) (Syntax: 'x')
Area-Analyzers Bug Feature - IOperation Urgency-Soon

Most helpful comment

All 2 comments

I agree with @genlu as I've been caught out by that.

Was this page helpful?
0 / 5 - 0 ratings