提交 28b182d8 编写于 作者: V vsadov

added a test with two arguments

上级 831323c1
......@@ -3926,5 +3926,33 @@ static void M1()
Diagnostic(ErrorCode.ERR_InDynamicMethodArg, "x").WithLocation(8, 17)
);
}
[WorkItem(22813, "https://github.com/dotnet/roslyn/issues/22813")]
[Fact]
public void InArgumentDynamic2()
{
string source = @"
class C
{
static void M1()
{
int x = 42;
dynamic d = null;
d.M2(1, in d, 123, in x);
}
}
";
var comp = CreateCompilationWithMscorlib45AndCSruntime(source, parseOptions: TestOptions.Regular7_2);
comp.VerifyEmitDiagnostics(
// (8,20): error CS8364: Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.
// d.M2(1, in d, 123, in x);
Diagnostic(ErrorCode.ERR_InDynamicMethodArg, "d").WithLocation(8, 20),
// (8,31): error CS8364: Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.
// d.M2(1, in d, 123, in x);
Diagnostic(ErrorCode.ERR_InDynamicMethodArg, "x").WithLocation(8, 31)
);
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册