提交 8b2b02f0 编写于 作者: C CyrusNajmabadi

Adding test.

上级 2c4c3f3b
......@@ -4373,6 +4373,26 @@ class B<out U> { }
Diagnostic(ErrorCode.ERR_IllegalVarianceSyntax, "out").WithLocation(15, 14));
}
[Fact]
public void CS1960ERR_IllegalVarianceSyntax_LocalFunction()
{
var test =
@"class C
{
void M()
{
void Local<in T>() { }
}
}";
CreateCompilationWithMscorlib(test).VerifyDiagnostics(
// (5,20): error CS1960: Invalid variance modifier. Only interface and delegate type parameters can be specified as variant.
// void Local<in T>() { }
Diagnostic(ErrorCode.ERR_IllegalVarianceSyntax, "in").WithLocation(5, 20),
// (5,14): warning CS0168: The variable 'Local' is declared but never used
// void Local<in T>() { }
Diagnostic(ErrorCode.WRN_UnreferencedVar, "Local").WithArguments("Local").WithLocation(5, 14));
}
[Fact]
public void CS7000ERR_UnexpectedAliasedName()
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册