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
18.97k stars 4.03k forks source link

VB DIM: Class is not required to implement a virtual interface method #35820

Closed AlekseyTs closed 5 years ago

AlekseyTs commented 5 years ago
        <Fact>
        Public Sub MethodImplementation_01()

            Dim csSource =
"
public interface I1
{
    void M1() 
    {
    }
}
"
            Dim csCompiation = GetCSharpCompiation(csSource).EmitToImageReference()

            Dim source1 =
<compilation>
    <file name="c.vb"><![CDATA[
Public Class C
    Implements I1
End Class
]]></file>
</compilation>

            Dim comp1 = CreateCompilation(source1, targetFramework:=TargetFramework.NetStandardLatest, references:={csCompiation})
            comp1.AssertTheseDiagnostics(
<errors>
BC30149: Class 'C' must implement 'Sub M1()' for interface 'I1'.
    Implements I1
               ~~
</errors>
            )
        End Sub

Observed: The expected error is not reported

AlekseyTs commented 5 years ago

See also https://github.com/dotnet/roslyn/issues/35821