From 725728a3c391c9a247b858bfeeb9f312aeb3e1ba Mon Sep 17 00:00:00 2001 From: Marc Zwart Date: Sun, 16 Oct 2022 21:47:37 +0200 Subject: [PATCH] update comments in tests to reflect message change --- .../Test/Semantic/Semantics/ArglistTests.cs | 2 +- .../Semantic/Semantics/InitOnlyMemberTests.cs | 2 +- .../Semantics/NullableReferenceTypesTests.cs | 2 +- .../Semantics/RefLocalsAndReturnsTests.cs | 4 ++-- .../Semantic/Semantics/SemanticErrorTests.cs | 20 +++++++++---------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/ArglistTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/ArglistTests.cs index 18bb030c0cefb..926c5fdb5eea1 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/ArglistTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/ArglistTests.cs @@ -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) diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/InitOnlyMemberTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/InitOnlyMemberTests.cs index f01c983054cbd..e7b7912c86eb3 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/InitOnlyMemberTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/InitOnlyMemberTests.cs @@ -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) ); diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs index 55637c47ebe54..737a07f99c429 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs @@ -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. diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/RefLocalsAndReturnsTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/RefLocalsAndReturnsTests.cs index 50681c9578a6a..c5f64ef62aa22 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/RefLocalsAndReturnsTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/RefLocalsAndReturnsTests.cs @@ -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)); } @@ -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)); } diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs index 957d2f7d11fc5..7062a7a02502b 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs @@ -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)); } @@ -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)); } @@ -22856,13 +22856,13 @@ static void Test(Func Baz) // (17,47): error CS1510: A ref or out argument must be an assignable variable // var z5 = new Func(ref Goo(x => x)); Diagnostic(ErrorCode.ERR_RefLvalueExpected, "Goo(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(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(ref new Func(x => x)); Diagnostic(ErrorCode.ERR_RefLvalueExpected, "new Func(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(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 @@ -22889,13 +22889,13 @@ static void Test(Func Baz) // (17,47): error CS1510: A ref or out argument must be an assignable variable // var z5 = new Func(ref Goo(x => x)); Diagnostic(ErrorCode.ERR_RefLvalueExpected, "Goo(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(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(ref new Func(x => x)); Diagnostic(ErrorCode.ERR_RefLvalueExpected, "new Func(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(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 @@ -23007,7 +23007,7 @@ static void Test(Func Baz) // (10,46): error CS0149: Method name expected // var c = new Func(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(ref BarP, BarP.Invoke); Diagnostic(ErrorCode.ERR_RefProperty, "ref BarP").WithLocation(11, 42), // (11,46): error CS0149: Method name expected @@ -23016,7 +23016,7 @@ static void Test(Func Baz) // (12,42): error CS0149: Method name expected // var e = new Func(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(ref BarP, ref BarP.Invoke); Diagnostic(ErrorCode.ERR_RefProperty, "ref BarP").WithLocation(13, 42), // (13,46): error CS0149: Method name expected