diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/InheritanceBindingTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/InheritanceBindingTests.cs index 4f6e9c41c7410654fa896a90652f6c9e66e9dd1f..8328ac79971c6a4c0e4063cd8d523b7eb8226a1b 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/InheritanceBindingTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/InheritanceBindingTests.cs @@ -9022,9 +9022,9 @@ class Derived : Base // (8,26): error CS0115: 'Derived.Goo(T)': no suitable method found to override // public override void Goo(T value) where T : struct, class { } Diagnostic(ErrorCode.ERR_OverrideNotExpected, "Goo").WithArguments("Derived.Goo(T)").WithLocation(8, 26), - // (8,60): error CS8869: The 'class' constraint cannot be combined with the 'struct' constraint + // (8,60): error CS0449: The 'class', 'struct', 'unmanaged', and 'notnull' constraints cannot be combined or duplicated, and must be specified first in the constraints list. // public override void Goo(T value) where T : struct, class { } - Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst).WithLocation(8, 60)); + Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst, "class").WithLocation(8, 60)); } [Fact] @@ -9044,9 +9044,9 @@ class Derived : Base // (8,26): error CS0115: 'Derived.Goo(T)': no suitable method found to override // public override void Goo(T value) where T : class, struct { } Diagnostic(ErrorCode.ERR_OverrideNotExpected, "Goo").WithArguments("Derived.Goo(T)").WithLocation(8, 26), - // (8,59): error CS8869: The 'struct' constraint cannot be combined with the 'class' constraint + // (8,59): error CS0449: The 'class', 'struct', 'unmanaged', and 'notnull' constraints cannot be combined or duplicated, and must be specified first in the constraints list. // public override void Goo(T value) where T : class, struct { } - Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst).WithLocation(8, 59)); + Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst, "struct").WithLocation(8, 59)); } [Fact] @@ -9064,9 +9064,9 @@ class Derived : Base } "; var comp = CreateCompilation(source).VerifyDiagnostics( - // (9,60): error CS8869: The 'class' constraint cannot be combined with the 'struct' constraint + // (9,60): error CS0449: The 'class', 'struct', 'unmanaged', and 'notnull' constraints cannot be combined or duplicated, and must be specified first in the constraints list. // public override void Goo(T value) where T : struct, class { } - Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst).WithLocation(9, 60)); + Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst, "class").WithLocation(9, 60)); } [Fact] @@ -9086,10 +9086,9 @@ class C : I // (8,12): error CS0539: 'C.Goo(T)' in explicit interface declaration is not found among members of the interface that can be implemented // void I.Goo(T value) where T : struct, class { } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "Goo").WithArguments("C.Goo(T)").WithLocation(8, 12), - // (8,46): error CS8869: The 'class' constraint cannot be combined with the 'struct' constraint + // (8,46): error CS0449: The 'class', 'struct', 'unmanaged', and 'notnull' constraints cannot be combined or duplicated, and must be specified first in the constraints list. // void I.Goo(T value) where T : struct, class { } - Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst).WithLocation(8, 46) - ); + Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst, "class").WithLocation(8, 46)); } [Fact] @@ -9109,9 +9108,9 @@ class C : I // (8,12): error CS0539: 'C.Goo(T)' in explicit interface declaration is not found among members of the interface that can be implemented // void I.Goo(T value) where T : class, struct { } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "Goo").WithArguments("C.Goo(T)").WithLocation(8, 12), - // (8,45): error CS8869: The 'struct' constraint cannot be combined with the 'class' constraint + // (8,45): error CS0449: The 'class', 'struct', 'unmanaged', and 'notnull' constraints cannot be combined or duplicated, and must be specified first in the constraints list. // void I.Goo(T value) where T : class, struct { } - Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst).WithLocation(8, 45)); + Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst, "struct").WithLocation(8, 45)); } [Fact] @@ -9129,9 +9128,9 @@ class C : I } "; var comp = CreateCompilation(source).VerifyDiagnostics( - // (9,46): error CS8869: The 'class' constraint cannot be combined with the 'struct' constraint + // (9,46): error CS0449: The 'class', 'struct', 'unmanaged', and 'notnull' constraints cannot be combined or duplicated, and must be specified first in the constraints list. // void I.Goo(T value) where T : struct, class { } - Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst).WithLocation(9, 46)); + Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst, "class").WithLocation(9, 46)); } [Fact] diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs index c0ba167fed8c4ecdf41fcff27bd8556acb3114a1..8455d11226e6b1eb3901ad4a67eae10f205241c1 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs @@ -81660,10 +81660,10 @@ class B comp.VerifyDiagnostics( // (8,59): error CS0449: The 'class', 'struct', 'unmanaged', and 'notnull' constraints cannot be combined or duplicated, and must be specified first in the constraints list. // public static void F2(T2? t2) where T2 : notnull, struct - Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst).WithLocation(8, 59), + Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst, "struct").WithLocation(8, 59), // (4,58): error CS0449: The 'class', 'struct', 'unmanaged', and 'notnull' constraints cannot be combined or duplicated, and must be specified first in the constraints list. // public static void F1(T1? t1) where T1 : struct, notnull - Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst).WithLocation(4, 58) + Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst, "notnull").WithLocation(4, 58) ); var m = comp.SourceModule; @@ -81704,10 +81704,10 @@ class B comp.VerifyDiagnostics( // (4,57): error CS0449: The 'class', 'struct', 'unmanaged', and 'notnull' constraints cannot be combined or duplicated, and must be specified first in the constraints list. // public static void F1(T1? t1) where T1 : class, notnull - Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst).WithLocation(4, 57), + Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst, "notnull").WithLocation(4, 57), // (8,59): error CS0449: The 'class', 'struct', 'unmanaged', and 'notnull' constraints cannot be combined or duplicated, and must be specified first in the constraints list. // public static void F2(T2? t2) where T2 : notnull, class - Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst).WithLocation(8, 59) + Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst, "class").WithLocation(8, 59) ); var m = comp.SourceModule; @@ -81749,10 +81749,10 @@ class B comp.VerifyDiagnostics( // (4,58): error CS0449: The 'class', 'struct', 'unmanaged', and 'notnull' constraints cannot be combined or duplicated, and must be specified first in the constraints list. // public static void F1(T1? t1) where T1 : class?, notnull - Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst).WithLocation(4, 58), + Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst, "notnull").WithLocation(4, 58), // (8,59): error CS0449: The 'class', 'struct', 'unmanaged', and 'notnull' constraints cannot be combined or duplicated, and must be specified first in the constraints list. // public static void F2(T2? t2) where T2 : notnull, class? - Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst).WithLocation(8, 59) + Diagnostic(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst, "class").WithLocation(8, 59) ); var m = comp.SourceModule;