Skip to content

Commit

Permalink
update comments in tests to reflect message change
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcadeMode committed Oct 16, 2022
1 parent ac14042 commit 725728a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static void Main()
// (9,40): error CS1510: A ref or out value must be an assignable variable
// TypedReference tr3 = __makeref(123); // CS1510
Diagnostic(ErrorCode.ERR_RefLvalueExpected, "123").WithLocation(9, 40),
// (10,40): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (10,40): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// TypedReference tr4 = __makeref(P); // CS0206
Diagnostic(ErrorCode.ERR_RefProperty, "P").WithLocation(10, 40),
// (11,40): error CS0199: A static readonly field cannot be used as a ref or out value (except in a static constructor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ void M()
";
var comp = CreateCompilation(new[] { source, IsExternalInitTypeDefinition }, parseOptions: TestOptions.Regular9);
comp.VerifyEmitDiagnostics(
// (8,16): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (8,16): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// M2(out Property); // 1
Diagnostic(ErrorCode.ERR_RefProperty, "Property").WithLocation(8, 16)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33580,7 +33580,7 @@ public void M()
// (12,9): warning CS8602: Dereference of a possibly null reference.
// field.ToString(); // 4
Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "field").WithLocation(12, 9),
// (14,15): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (14,15): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// M(ref Property); // 5
Diagnostic(ErrorCode.ERR_RefProperty, "Property").WithLocation(14, 15),
// (15,20): warning CS8625: Cannot convert null literal to non-nullable reference type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3178,7 +3178,7 @@ static void M()
";

CreateCompilationWithMscorlib46(text).VerifyDiagnostics(
// (8,26): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (8,26): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// ref int rl = ref P;
Diagnostic(ErrorCode.ERR_RefProperty, "P").WithLocation(8, 26));
}
Expand All @@ -3199,7 +3199,7 @@ void M()
";

CreateCompilationWithMscorlib46(text).VerifyDiagnostics(
// (8,26): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (8,26): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// ref int rl = ref this[0];
Diagnostic(ErrorCode.ERR_RefProperty, "this[0]").WithLocation(8, 26));
}
Expand Down
20 changes: 10 additions & 10 deletions src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8042,10 +8042,10 @@ void M()
}
";
CreateCompilation(text).VerifyDiagnostics(
// (14,15): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (14,15): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// M(ref P); // CS0206
Diagnostic(ErrorCode.ERR_RefProperty, "P").WithLocation(14, 15),
// (15,15): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (15,15): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// M(out this.Q); // CS0206
Diagnostic(ErrorCode.ERR_RefProperty, "this.Q").WithLocation(15, 15));
}
Expand All @@ -8072,10 +8072,10 @@ void M()
}
";
CreateCompilation(text).VerifyDiagnostics(
// (13,15): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (13,15): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// R(ref this[0]); // CS0206
Diagnostic(ErrorCode.ERR_RefProperty, "this[0]").WithLocation(13, 15),
// (14,15): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (14,15): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// O(out this[0]); // CS0206
Diagnostic(ErrorCode.ERR_RefProperty, "this[0]").WithLocation(14, 15));
}
Expand Down Expand Up @@ -22856,13 +22856,13 @@ static void Test(Func<string, string> Baz)
// (17,47): error CS1510: A ref or out argument must be an assignable variable
// var z5 = new Func<string, string>(ref Goo<string>(x => x));
Diagnostic(ErrorCode.ERR_RefLvalueExpected, "Goo<string>(x => x)").WithLocation(17, 47),
// (18,43): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (18,43): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// var z6 = new Func<string, string>(ref BarP);
Diagnostic(ErrorCode.ERR_RefProperty, "ref BarP").WithLocation(18, 43),
// (19,47): error CS1510: A ref or out argument must be an assignable variable
// var z7 = new Func<string, string>(ref new Func<string, string>(x => x));
Diagnostic(ErrorCode.ERR_RefLvalueExpected, "new Func<string, string>(x => x)").WithLocation(19, 47),
// (20,43): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (20,43): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// var z8 = new Func<string, string>(ref Program.BarP);
Diagnostic(ErrorCode.ERR_RefProperty, "ref Program.BarP").WithLocation(20, 43),
// (21,47): error CS1510: A ref or out argument must be an assignable variable
Expand All @@ -22889,13 +22889,13 @@ static void Test(Func<string, string> Baz)
// (17,47): error CS1510: A ref or out argument must be an assignable variable
// var z5 = new Func<string, string>(ref Goo<string>(x => x));
Diagnostic(ErrorCode.ERR_RefLvalueExpected, "Goo<string>(x => x)").WithLocation(17, 47),
// (18,47): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (18,47): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// var z6 = new Func<string, string>(ref BarP);
Diagnostic(ErrorCode.ERR_RefProperty, "BarP").WithLocation(18, 47),
// (19,47): error CS1510: A ref or out argument must be an assignable variable
// var z7 = new Func<string, string>(ref new Func<string, string>(x => x));
Diagnostic(ErrorCode.ERR_RefLvalueExpected, "new Func<string, string>(x => x)").WithLocation(19, 47),
// (20,47): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (20,47): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// var z8 = new Func<string, string>(ref Program.BarP);
Diagnostic(ErrorCode.ERR_RefProperty, "Program.BarP").WithLocation(20, 47),
// (21,47): error CS1510: A ref or out argument must be an assignable variable
Expand Down Expand Up @@ -23007,7 +23007,7 @@ static void Test(Func<string, string> Baz)
// (10,46): error CS0149: Method name expected
// var c = new Func<string, string>(ref Baz, ref Baz.Invoke);
Diagnostic(ErrorCode.ERR_MethodNameExpected, "Baz, ref Baz.Invoke").WithLocation(10, 46),
// (11,42): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (11,42): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// var d = new Func<string, string>(ref BarP, BarP.Invoke);
Diagnostic(ErrorCode.ERR_RefProperty, "ref BarP").WithLocation(11, 42),
// (11,46): error CS0149: Method name expected
Expand All @@ -23016,7 +23016,7 @@ static void Test(Func<string, string> Baz)
// (12,42): error CS0149: Method name expected
// var e = new Func<string, string>(BarP, ref BarP.Invoke);
Diagnostic(ErrorCode.ERR_MethodNameExpected, "BarP, ref BarP.Invoke").WithLocation(12, 42),
// (13,42): error CS0206: A property or indexer may not be passed as an out or ref parameter
// (13,42): error CS0206: An indexer or auto-implemented property may not be used as an out or ref value
// var f = new Func<string, string>(ref BarP, ref BarP.Invoke);
Diagnostic(ErrorCode.ERR_RefProperty, "ref BarP").WithLocation(13, 42),
// (13,46): error CS0149: Method name expected
Expand Down

0 comments on commit 725728a

Please sign in to comment.