11 references to ERR_AnonDelegateCantUseRefLike
Microsoft.CodeAnalysis.CSharp (2)
Binder\Binder_Expressions.cs (1)
1934
Error(diagnostics, parameter.Type.IsRefLikeType ? ErrorCode.
ERR_AnonDelegateCantUseRefLike
: ErrorCode.ERR_AnonDelegateCantUse, node, parameter.Name);
Errors\ErrorFacts.cs (1)
1228
case ErrorCode.
ERR_AnonDelegateCantUseRefLike
:
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (9)
Semantics\PrimaryConstructorTests.cs (9)
15164
("0011", BadReference, "(S1 p1) { void M1() { local(); void local() { p1.M(); } } } ref struct S1{ public void M(){} }", ErrorCode.
ERR_AnonDelegateCantUseRefLike
),
15165
("0012", BadReference, "(S1 p1) { void M1() { local1(); void local1() { local2(); void local2() { p1.M(); } } } } ref struct S1{ public void M(){} }", ErrorCode.
ERR_AnonDelegateCantUseRefLike
),
15169
("0016", BadReference, "(S1 p1) { void M1() { _ = (System.Action)(() => { p1.M(); }); } } ref struct S1{ public void M(){} }", ErrorCode.
ERR_AnonDelegateCantUseRefLike
),
15193
("0210", BadReference, "(S1 p1) { System.Action F = () => p1.ToString(); } ref struct S1{ public void M(){} }", ErrorCode.
ERR_AnonDelegateCantUseRefLike
),
15194
("0211", BadReference, "(S1 p1) { System.Action P { get; } = () => p1.ToString(); } ref struct S1{ public void M(){} }", ErrorCode.
ERR_AnonDelegateCantUseRefLike
),
15195
("0212", BadReference, "(S1 p1) { public event System.Action E = () => p1.ToString(); } ref struct S1{ public void M(){} }", ErrorCode.
ERR_AnonDelegateCantUseRefLike
),
15216
("1004", BadReference, "(S1 p1) : Base(() => p1.ToString()); ref struct S1{ public void M(){} } class Base { public Base(System.Action x) {} }", ErrorCode.
ERR_AnonDelegateCantUseRefLike
),
15267
case ErrorCode.
ERR_AnonDelegateCantUseRefLike
:
15271
Diagnostic(ErrorCode.
ERR_AnonDelegateCantUseRefLike
, "p1").WithArguments("p1").WithLocation(2000, 1)