未验证 提交 0898a78e 编写于 作者: N Neal Gafter 提交者: GitHub

Add test for reported issue (#41703)

Fixes #41481
上级 86437420
......@@ -59855,5 +59855,32 @@ interface I1<T>
Diagnostic(ErrorCode.ERR_ClassDoesntImplementInterface, "I1<int>").WithArguments("I1<T>.P1", "I1<int>").WithLocation(4, 9)
);
}
[Fact, WorkItem(41481, "https://github.com/dotnet/roslyn/issues/41481")]
public void IncompletePropertyImplementationSyntax_01()
{
var source1 =
@"interface A
{
object A.B{";
var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll,
parseOptions: TestOptions.Regular,
targetFramework: TargetFramework.NetStandardLatest);
Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation);
compilation1.VerifyDiagnostics(
// (3,12): error CS0540: 'A.B': containing type does not implement interface 'A'
// object A.B{
Diagnostic(ErrorCode.ERR_ClassDoesntImplementInterface, "A").WithArguments("A.B", "A").WithLocation(3, 12),
// (3,14): error CS0548: 'A.B': property or indexer must have at least one accessor
// object A.B{
Diagnostic(ErrorCode.ERR_PropertyWithNoAccessors, "B").WithArguments("A.B").WithLocation(3, 14),
// (3,16): error CS1513: } expected
// object A.B{
Diagnostic(ErrorCode.ERR_RbraceExpected, "").WithLocation(3, 16),
// (3,16): error CS1513: } expected
// object A.B{
Diagnostic(ErrorCode.ERR_RbraceExpected, "").WithLocation(3, 16)
);
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册