diff --git a/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md b/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md index e4a592fca6c1f..ae87d27da4b4e 100644 --- a/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md +++ b/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md @@ -391,3 +391,16 @@ Console.WriteLine($"{{{12:X}}}"); The workaround is to remove the extra braces in the format string. You can learn more about this change in the associated [roslyn issue](https://github.com/dotnet/roslyn/issues/57750). + +## Types cannot be named `required` + +***Introduced in Visual Studio 2022 version 17.3.*** Starting in C# 11, types cannot be named `required`. The compiler will report an error on all such type names. To work around this, the type name and all usages must be escaped with an `@`: + +```csharp +class required {} // Error CS9029 +class @required {} // No error +``` + +This was done as `required` is now a member modifier for properties and fields. + +You can learn more about this change in the associated [csharplang issue](https://github.com/dotnet/csharplang/issues/3630). diff --git a/docs/contributing/Compiler Test Plan.md b/docs/contributing/Compiler Test Plan.md index 31b02c8061806..0219996d62e13 100644 --- a/docs/contributing/Compiler Test Plan.md +++ b/docs/contributing/Compiler Test Plan.md @@ -39,8 +39,8 @@ This document provides guidance for thinking about language interactions and tes - Access modifiers (public, protected, internal, protected internal, private protected, private), static, ref - type declarations (class, record class/struct with or without positional members, struct, interface, type parameter) - methods -- fields -- properties (including get/set/init accessors) +- fields (required and not) +- properties (including get/set/init accessors, required and not) - events (including add/remove accessors) - Parameter modifiers (ref, out, in, params) - Attributes (including generic attributes and security attributes) @@ -110,6 +110,7 @@ This document provides guidance for thinking about language interactions and tes - pre-processing directives - COM interop - modopt and modreq +- CompilerFeatureRequiredAttribute - ref assemblies - extern alias - UnmanagedCallersOnly diff --git a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs index 6a9fcdad67492..ef0347db4c3ba 100644 --- a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs +++ b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs @@ -2070,26 +2070,24 @@ internal enum ErrorCode ERR_ExpressionTreeContainsUTF8StringLiterals = 9027, ERR_MisplacedUnchecked = 9028, + ERR_RequiredNameDisallowed = 9029, + ERR_OverrideMustHaveRequired = 9030, + ERR_RequiredMemberCannotBeHidden = 9031, + ERR_RequiredMemberCannotBeLessVisibleThanContainingType = 9032, + ERR_ExplicitRequiredMember = 9033, + ERR_RequiredMemberMustBeSettable = 9034, + ERR_RequiredMemberMustBeSet = 9035, + ERR_RequiredMembersMustBeAssignedValue = 9036, + ERR_RequiredMembersInvalid = 9037, + ERR_RequiredMembersBaseTypeInvalid = 9038, + ERR_ChainingToSetsRequiredMembersRequiresSetsRequiredMembers = 9039, + ERR_NewConstraintCannotHaveRequiredMembers = 9040, + ERR_UnsupportedCompilerFeature = 9041, + WRN_ObsoleteMembersShouldNotBeRequired = 9042, + ERR_RefReturningPropertiesCannotBeRequired = 9043, + #endregion // Note: you will need to re-generate compiler code after adding warnings (eng\generate-compiler-code.cmd) - - // PROTOTYPE(req): Move above the comment and condense before merge - - ERR_RequiredNameDisallowed = 9500, - ERR_OverrideMustHaveRequired = 9501, - ERR_RequiredMemberCannotBeHidden = 9502, - ERR_RequiredMemberCannotBeLessVisibleThanContainingType = 9503, - ERR_ExplicitRequiredMember = 9504, - ERR_RequiredMemberMustBeSettable = 9505, - ERR_RequiredMemberMustBeSet = 9506, - ERR_RequiredMembersMustBeAssignedValue = 9507, - ERR_RequiredMembersInvalid = 9508, - ERR_RequiredMembersBaseTypeInvalid = 9509, - ERR_ChainingToSetsRequiredMembersRequiresSetsRequiredMembers = 9510, - ERR_NewConstraintCannotHaveRequiredMembers = 9511, - ERR_UnsupportedCompilerFeature = 9512, - WRN_ObsoleteMembersShouldNotBeRequired = 9513, - ERR_RefReturningPropertiesCannotBeRequired = 9514, } } diff --git a/src/Compilers/CSharp/Portable/Errors/MessageID.cs b/src/Compilers/CSharp/Portable/Errors/MessageID.cs index 01417e526878e..9fdea9974de1b 100644 --- a/src/Compilers/CSharp/Portable/Errors/MessageID.cs +++ b/src/Compilers/CSharp/Portable/Errors/MessageID.cs @@ -238,9 +238,6 @@ internal enum MessageID IDS_FeatureGenericAttributes = MessageBase + 12812, - // PROTOTYPE(req): here for avoiding merge conflicts. Move to the end and condense before merge. - IDS_FeatureRequiredMembers = MessageBase + 13000, - IDS_FeatureNewLinesInInterpolations = MessageBase + 12813, IDS_FeatureListPattern = MessageBase + 12814, IDS_ParameterNullChecking = MessageBase + 12815, @@ -257,6 +254,7 @@ internal enum MessageID IDS_FeatureUnsignedRightShift = MessageBase + 12823, IDS_FeatureExtendedNameofScope = MessageBase + 12824, IDS_FeatureRelaxedShiftOperator = MessageBase + 12825, + IDS_FeatureRequiredMembers = MessageBase + 12826, } // Message IDs may refer to strings that need to be localized. diff --git a/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs b/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs index c85ea9a1c6286..99dfe4879623f 100644 --- a/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs +++ b/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs @@ -1173,8 +1173,9 @@ internal static DeclarationModifiers GetModifier(SyntaxKind kind, SyntaxKind con } } - private void ParseModifiers(SyntaxListBuilder tokens, bool forAccessors) + private void ParseModifiers(SyntaxListBuilder tokens, bool forAccessors, bool forTopLevelStatements) { + Debug.Assert(!(forAccessors && forTopLevelStatements)); while (true) { var newMod = GetModifier(this.CurrentToken); @@ -1258,8 +1259,9 @@ private void ParseModifiers(SyntaxListBuilder tokens, bool forAccessors) case DeclarationModifiers.Required: // In C# 11, required in a modifier position is always a keyword if not escaped. Otherwise, we reuse the async detection // machinery to make a conservative guess as to whether the user meant required to be a keyword, so that they get a good langver - // diagnostic and all the machinery to upgrade their project kicks in. - if (!IsFeatureEnabled(MessageID.IDS_FeatureRequiredMembers) && !ShouldAsyncOrRequiredBeTreatedAsModifier(parsingStatementNotDeclaration: false)) + // diagnostic and all the machinery to upgrade their project kicks in. The only exception to this rule is top level statements, + // where the user could conceivably have a local named required. For these locations, we need to disambiguate as well. + if ((!IsFeatureEnabled(MessageID.IDS_FeatureRequiredMembers) || forTopLevelStatements) && !ShouldAsyncOrRequiredBeTreatedAsModifier(parsingStatementNotDeclaration: false)) { return; } @@ -2373,7 +2375,7 @@ private MemberDeclarationSyntax ParseMemberDeclarationOrStatementCore(SyntaxKind } // All modifiers that might start an expression are processed above. - this.ParseModifiers(modifiers, forAccessors: false); + this.ParseModifiers(modifiers, forAccessors: false, forTopLevelStatements: true); bool haveModifiers = (modifiers.Count > 0); MemberDeclarationSyntax result; @@ -2826,7 +2828,7 @@ private MemberDeclarationSyntax ParseMemberDeclarationCore(SyntaxKind parentKind { var attributes = this.ParseAttributeDeclarations(); - this.ParseModifiers(modifiers, forAccessors: false); + this.ParseModifiers(modifiers, forAccessors: false, forTopLevelStatements: false); // Check for constructor form if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) @@ -4120,7 +4122,7 @@ private AccessorDeclarationSyntax ParseAccessorDeclaration(bool isEvent) try { var accAttrs = this.ParseAttributeDeclarations(); - this.ParseModifiers(accMods, forAccessors: true); + this.ParseModifiers(accMods, forAccessors: true, forTopLevelStatements: false); // check availability of readonly members feature for accessors CheckForVersionSpecificModifiers(accMods, SyntaxKind.ReadOnlyKeyword, MessageID.IDS_FeatureReadOnlyMembers); diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/CSharpCompilerFeatureRequiredTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/CSharpCompilerFeatureRequiredTests.cs index 1de6ce3a0be82..78f82892ae51a 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/CSharpCompilerFeatureRequiredTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/CSharpCompilerFeatureRequiredTests.cs @@ -73,70 +73,70 @@ protected override CompilationVerifier CompileAndVerify(CSharpCompilation compil protected override void AssertNormalErrors(CSharpCompilation comp) { comp.VerifyDiagnostics( - // (2,1): error CS9512: 'OnType' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (2,1): error CS9041: 'OnType' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnType onType; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnType").WithArguments("OnType", "test").WithLocation(2, 1), - // (3,1): error CS9512: 'OnType' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (3,1): error CS9041: 'OnType' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnType.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnType").WithArguments("OnType", "test").WithLocation(3, 1), - // (3,8): error CS9512: 'OnType' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (3,8): error CS9041: 'OnType' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnType.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("OnType", "test").WithLocation(3, 8), - // (4,10): error CS9512: 'OnMethod.M()' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (4,10): error CS9041: 'OnMethod.M()' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethod.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("OnMethod.M()", "test").WithLocation(4, 10), - // (5,16): error CS9512: 'void' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (5,16): error CS9041: 'void' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethodReturn.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("void", "test").WithLocation(5, 16), - // (6,13): error CS9512: 'int' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (6,13): error CS9041: 'int' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnParameter.M(1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("int", "test").WithLocation(6, 13), - // (7,13): error CS9512: 'OnField.Field' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (7,13): error CS9041: 'OnField.Field' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnField.Field; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Field").WithArguments("OnField.Field", "test").WithLocation(7, 13), - // (8,12): error CS9512: 'OnProperty.Property' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (8,12): error CS9041: 'OnProperty.Property' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnProperty.Property = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("OnProperty.Property", "test").WithLocation(8, 12), - // (9,16): error CS9512: 'OnProperty.Property' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (9,16): error CS9041: 'OnProperty.Property' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnProperty.Property; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("OnProperty.Property", "test").WithLocation(9, 16), - // (10,18): error CS9512: 'OnPropertySetter.Property.set' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (10,18): error CS9041: 'OnPropertySetter.Property.set' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnPropertySetter.Property = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("OnPropertySetter.Property.set", "test").WithLocation(10, 18), - // (13,22): error CS9512: 'OnPropertyGetter.Property.get' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (13,22): error CS9041: 'OnPropertyGetter.Property.get' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnPropertyGetter.Property; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("OnPropertyGetter.Property.get", "test").WithLocation(13, 22), - // (14,9): error CS9512: 'OnEvent.Event' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (14,9): error CS9041: 'OnEvent.Event' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEvent.Event += () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Event").WithArguments("OnEvent.Event", "test").WithLocation(14, 9), - // (15,9): error CS9512: 'OnEvent.Event' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (15,9): error CS9041: 'OnEvent.Event' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEvent.Event -= () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Event").WithArguments("OnEvent.Event", "test").WithLocation(15, 9), - // (20,1): error CS9512: 'OnEnum' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (20,1): error CS9041: 'OnEnum' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEnum onEnum; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEnum").WithArguments("OnEnum", "test").WithLocation(20, 1), - // (21,18): error CS9512: 'OnEnumMember.A' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (21,18): error CS9041: 'OnEnumMember.A' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnEnumMember.A; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "A").WithArguments("OnEnumMember.A", "test").WithLocation(21, 18), - // (22,1): error CS9512: 'T' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (22,1): error CS9041: 'T' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnClassTypeParameter onClassTypeParameter; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnClassTypeParameter").WithArguments("T", "test").WithLocation(22, 1), - // (23,23): error CS9512: 'T' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (23,23): error CS9041: 'T' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethodTypeParameter.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("T", "test").WithLocation(23, 23), - // (24,1): error CS9512: 'OnDelegateType' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (24,1): error CS9041: 'OnDelegateType' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnDelegateType onDelegateType; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnDelegateType").WithArguments("OnDelegateType", "test").WithLocation(24, 1), - // (25,28): error CS9512: 'int' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (25,28): error CS9041: 'int' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnIndexedPropertyParameter.set_Property(1, 1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "set_Property").WithArguments("int", "test").WithLocation(25, 28), - // (26,32): error CS9512: 'int' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (26,32): error CS9041: 'int' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnIndexedPropertyParameter.get_Property(1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "get_Property").WithArguments("int", "test").WithLocation(26, 32), - // (27,1): error CS9512: 'int' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (27,1): error CS9041: 'int' requires compiler feature 'test', which is not supported by this version of the C# compiler. // new OnThisIndexerParameter()[1] = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "new OnThisIndexerParameter()[1]").WithArguments("int", "test").WithLocation(27, 1), - // (28,5): error CS9512: 'int' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (28,5): error CS9041: 'int' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = new OnThisIndexerParameter()[1]; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "new OnThisIndexerParameter()[1]").WithArguments("int", "test").WithLocation(28, 5) ); @@ -234,154 +234,154 @@ protected override void AssertNormalErrors(CSharpCompilation comp) protected override void AssertModuleErrors(CSharpCompilation comp, MetadataReference ilRef) { comp.VerifyDiagnostics( - // (2,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (2,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnType onType; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnType").WithArguments("OnModule", "test").WithLocation(2, 1), - // (3,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (3,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnType.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnType").WithArguments("OnModule", "test").WithLocation(3, 1), - // (3,8): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (3,8): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnType.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("OnModule", "test").WithLocation(3, 8), - // (4,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (4,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethod.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnMethod").WithArguments("OnModule", "test").WithLocation(4, 1), - // (4,10): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (4,10): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethod.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("OnModule", "test").WithLocation(4, 10), - // (5,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (5,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethodReturn.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnMethodReturn").WithArguments("OnModule", "test").WithLocation(5, 1), - // (5,16): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (5,16): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethodReturn.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("OnModule", "test").WithLocation(5, 16), - // (6,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (6,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnParameter.M(1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnParameter").WithArguments("OnModule", "test").WithLocation(6, 1), - // (6,13): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (6,13): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnParameter.M(1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("OnModule", "test").WithLocation(6, 13), - // (7,5): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (7,5): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnField.Field; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnField").WithArguments("OnModule", "test").WithLocation(7, 5), - // (7,13): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (7,13): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnField.Field; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Field").WithArguments("OnModule", "test").WithLocation(7, 13), - // (8,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (8,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnProperty.Property = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnProperty").WithArguments("OnModule", "test").WithLocation(8, 1), - // (8,12): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (8,12): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnProperty.Property = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("OnModule", "test").WithLocation(8, 12), - // (9,5): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (9,5): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnProperty.Property; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnProperty").WithArguments("OnModule", "test").WithLocation(9, 5), - // (9,16): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (9,16): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnProperty.Property; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("OnModule", "test").WithLocation(9, 16), - // (10,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (10,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnPropertySetter.Property = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnPropertySetter").WithArguments("OnModule", "test").WithLocation(10, 1), - // (10,18): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (10,18): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnPropertySetter.Property = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("OnModule", "test").WithLocation(10, 18), - // (11,5): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (11,5): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnPropertySetter.Property; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnPropertySetter").WithArguments("OnModule", "test").WithLocation(11, 5), - // (11,22): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (11,22): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnPropertySetter.Property; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("OnModule", "test").WithLocation(11, 22), - // (12,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (12,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnPropertyGetter.Property = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnPropertyGetter").WithArguments("OnModule", "test").WithLocation(12, 1), - // (12,18): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (12,18): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnPropertyGetter.Property = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("OnModule", "test").WithLocation(12, 18), - // (13,5): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (13,5): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnPropertyGetter.Property; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnPropertyGetter").WithArguments("OnModule", "test").WithLocation(13, 5), - // (13,22): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (13,22): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnPropertyGetter.Property; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("OnModule", "test").WithLocation(13, 22), - // (14,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (14,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEvent.Event += () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEvent").WithArguments("OnModule", "test").WithLocation(14, 1), - // (14,9): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (14,9): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEvent.Event += () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Event").WithArguments("OnModule", "test").WithLocation(14, 9), - // (15,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (15,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEvent.Event -= () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEvent").WithArguments("OnModule", "test").WithLocation(15, 1), - // (15,9): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (15,9): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEvent.Event -= () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Event").WithArguments("OnModule", "test").WithLocation(15, 9), - // (16,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (16,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventAdder.Event += () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEventAdder").WithArguments("OnModule", "test").WithLocation(16, 1), - // (16,14): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (16,14): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventAdder.Event += () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Event").WithArguments("OnModule", "test").WithLocation(16, 14), - // (17,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (17,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventAdder.Event -= () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEventAdder").WithArguments("OnModule", "test").WithLocation(17, 1), - // (17,14): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (17,14): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventAdder.Event -= () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Event").WithArguments("OnModule", "test").WithLocation(17, 14), - // (18,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (18,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventRemover.Event += () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEventRemover").WithArguments("OnModule", "test").WithLocation(18, 1), - // (18,16): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (18,16): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventRemover.Event += () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Event").WithArguments("OnModule", "test").WithLocation(18, 16), - // (19,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (19,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventRemover.Event -= () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEventRemover").WithArguments("OnModule", "test").WithLocation(19, 1), - // (19,16): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (19,16): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventRemover.Event -= () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Event").WithArguments("OnModule", "test").WithLocation(19, 16), - // (20,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (20,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEnum onEnum; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEnum").WithArguments("OnModule", "test").WithLocation(20, 1), - // (21,5): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (21,5): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnEnumMember.A; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEnumMember").WithArguments("OnModule", "test").WithLocation(21, 5), - // (21,18): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (21,18): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnEnumMember.A; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "A").WithArguments("OnModule", "test").WithLocation(21, 18), - // (22,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (22,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnClassTypeParameter onClassTypeParameter; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnClassTypeParameter").WithArguments("OnModule", "test").WithLocation(22, 1), - // (23,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (23,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethodTypeParameter.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnMethodTypeParameter").WithArguments("OnModule", "test").WithLocation(23, 1), - // (23,23): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (23,23): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethodTypeParameter.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("OnModule", "test").WithLocation(23, 23), - // (24,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (24,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnDelegateType onDelegateType; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnDelegateType").WithArguments("OnModule", "test").WithLocation(24, 1), - // (25,1): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (25,1): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnIndexedPropertyParameter.set_Property(1, 1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnIndexedPropertyParameter").WithArguments("OnModule", "test").WithLocation(25, 1), - // (25,28): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (25,28): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnIndexedPropertyParameter.set_Property(1, 1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "set_Property").WithArguments("OnModule", "test").WithLocation(25, 28), - // (26,5): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (26,5): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnIndexedPropertyParameter.get_Property(1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnIndexedPropertyParameter").WithArguments("OnModule", "test").WithLocation(26, 5), - // (26,32): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (26,32): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnIndexedPropertyParameter.get_Property(1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "get_Property").WithArguments("OnModule", "test").WithLocation(26, 32), - // (27,5): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (27,5): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // new OnThisIndexerParameter()[1] = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnThisIndexerParameter").WithArguments("OnModule", "test").WithLocation(27, 5), - // (27,5): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (27,5): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // new OnThisIndexerParameter()[1] = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnThisIndexerParameter").WithArguments("OnModule", "test").WithLocation(27, 5), - // (28,9): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (28,9): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = new OnThisIndexerParameter()[1]; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnThisIndexerParameter").WithArguments("OnModule", "test").WithLocation(28, 9), - // (28,9): error CS9512: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (28,9): error CS9041: 'OnModule' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = new OnThisIndexerParameter()[1]; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnThisIndexerParameter").WithArguments("OnModule", "test").WithLocation(28, 9) ); @@ -392,154 +392,154 @@ protected override void AssertModuleErrors(CSharpCompilation comp, MetadataRefer protected override void AssertAssemblyErrors(CSharpCompilation comp, MetadataReference ilRef) { comp.VerifyDiagnostics( - // (2,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (2,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnType onType; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnType").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(2, 1), - // (3,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (3,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnType.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnType").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(3, 1), - // (3,8): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (3,8): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnType.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(3, 8), - // (4,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (4,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethod.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnMethod").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(4, 1), - // (4,10): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (4,10): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethod.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(4, 10), - // (5,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (5,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethodReturn.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnMethodReturn").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(5, 1), - // (5,16): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (5,16): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethodReturn.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(5, 16), - // (6,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (6,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnParameter.M(1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnParameter").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(6, 1), - // (6,13): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (6,13): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnParameter.M(1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(6, 13), - // (7,5): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (7,5): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnField.Field; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnField").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(7, 5), - // (7,13): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (7,13): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnField.Field; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Field").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(7, 13), - // (8,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (8,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnProperty.Property = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnProperty").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(8, 1), - // (8,12): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (8,12): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnProperty.Property = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(8, 12), - // (9,5): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (9,5): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnProperty.Property; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnProperty").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(9, 5), - // (9,16): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (9,16): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnProperty.Property; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(9, 16), - // (10,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (10,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnPropertySetter.Property = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnPropertySetter").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(10, 1), - // (10,18): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (10,18): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnPropertySetter.Property = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(10, 18), - // (11,5): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (11,5): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnPropertySetter.Property; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnPropertySetter").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(11, 5), - // (11,22): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (11,22): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnPropertySetter.Property; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(11, 22), - // (12,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (12,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnPropertyGetter.Property = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnPropertyGetter").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(12, 1), - // (12,18): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (12,18): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnPropertyGetter.Property = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(12, 18), - // (13,5): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (13,5): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnPropertyGetter.Property; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnPropertyGetter").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(13, 5), - // (13,22): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (13,22): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnPropertyGetter.Property; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Property").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(13, 22), - // (14,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (14,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEvent.Event += () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEvent").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(14, 1), - // (14,9): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (14,9): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEvent.Event += () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Event").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(14, 9), - // (15,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (15,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEvent.Event -= () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEvent").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(15, 1), - // (15,9): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (15,9): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEvent.Event -= () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Event").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(15, 9), - // (16,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (16,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventAdder.Event += () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEventAdder").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(16, 1), - // (16,14): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (16,14): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventAdder.Event += () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Event").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(16, 14), - // (17,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (17,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventAdder.Event -= () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEventAdder").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(17, 1), - // (17,14): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (17,14): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventAdder.Event -= () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Event").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(17, 14), - // (18,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (18,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventRemover.Event += () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEventRemover").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(18, 1), - // (18,16): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (18,16): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventRemover.Event += () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Event").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(18, 16), - // (19,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (19,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventRemover.Event -= () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEventRemover").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(19, 1), - // (19,16): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (19,16): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEventRemover.Event -= () => {}; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "Event").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(19, 16), - // (20,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (20,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnEnum onEnum; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEnum").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(20, 1), - // (21,5): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (21,5): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnEnumMember.A; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnEnumMember").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(21, 5), - // (21,18): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (21,18): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnEnumMember.A; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "A").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(21, 18), - // (22,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (22,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnClassTypeParameter onClassTypeParameter; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnClassTypeParameter").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(22, 1), - // (23,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (23,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethodTypeParameter.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnMethodTypeParameter").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(23, 1), - // (23,23): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (23,23): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnMethodTypeParameter.M(); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "M").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(23, 23), - // (24,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (24,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnDelegateType onDelegateType; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnDelegateType").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(24, 1), - // (25,1): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (25,1): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnIndexedPropertyParameter.set_Property(1, 1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnIndexedPropertyParameter").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(25, 1), - // (25,28): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (25,28): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // OnIndexedPropertyParameter.set_Property(1, 1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "set_Property").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(25, 28), - // (26,5): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (26,5): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnIndexedPropertyParameter.get_Property(1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnIndexedPropertyParameter").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(26, 5), - // (26,32): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (26,32): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = OnIndexedPropertyParameter.get_Property(1); Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "get_Property").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(26, 32), - // (27,5): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (27,5): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // new OnThisIndexerParameter()[1] = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnThisIndexerParameter").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(27, 5), - // (27,5): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (27,5): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // new OnThisIndexerParameter()[1] = 1; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnThisIndexerParameter").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(27, 5), - // (28,9): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (28,9): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = new OnThisIndexerParameter()[1]; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnThisIndexerParameter").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(28, 9), - // (28,9): error CS9512: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. + // (28,9): error CS9041: 'AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' requires compiler feature 'test', which is not supported by this version of the C# compiler. // _ = new OnThisIndexerParameter()[1]; Diagnostic(ErrorCode.ERR_UnsupportedCompilerFeature, "OnThisIndexerParameter").WithArguments("AssemblyTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "test").WithLocation(28, 9) ); diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/RequiredMembersTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/RequiredMembersTests.cs index f70fdac7f2d69..b5acb595ec1f7 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/RequiredMembersTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/RequiredMembersTests.cs @@ -368,28 +368,28 @@ class required {} } : new[] { - // (4,12): error CS9500: Types and aliases cannot be named 'required'. + // (4,12): error CS9029: Types and aliases cannot be named 'required'. // struct required {} Diagnostic(ErrorCode.ERR_RequiredNameDisallowed, "required").WithLocation(4, 12), - // (8,11): error CS9500: Types and aliases cannot be named 'required'. + // (8,11): error CS9029: Types and aliases cannot be named 'required'. // class required {} Diagnostic(ErrorCode.ERR_RequiredNameDisallowed, "required").WithLocation(8, 11), - // (12,15): error CS9500: Types and aliases cannot be named 'required'. + // (12,15): error CS9029: Types and aliases cannot be named 'required'. // interface required {} Diagnostic(ErrorCode.ERR_RequiredNameDisallowed, "required").WithLocation(12, 15), - // (16,19): error CS9500: Types and aliases cannot be named 'required'. + // (16,19): error CS9029: Types and aliases cannot be named 'required'. // delegate void required(); Diagnostic(ErrorCode.ERR_RequiredNameDisallowed, "required").WithLocation(16, 19), - // (20,12): error CS9500: Types and aliases cannot be named 'required'. + // (20,12): error CS9029: Types and aliases cannot be named 'required'. // record required(); Diagnostic(ErrorCode.ERR_RequiredNameDisallowed, "required").WithLocation(20, 12), - // (24,19): error CS9500: Types and aliases cannot be named 'required'. + // (24,19): error CS9029: Types and aliases cannot be named 'required'. // record struct required(); Diagnostic(ErrorCode.ERR_RequiredNameDisallowed, "required").WithLocation(24, 19), - // (30,15): error CS9500: Types and aliases cannot be named 'required'. + // (30,15): error CS9029: Types and aliases cannot be named 'required'. // class required {} Diagnostic(ErrorCode.ERR_RequiredNameDisallowed, "required").WithLocation(30, 15), - // (35,11): error CS9500: Types and aliases cannot be named 'required'. + // (35,11): error CS9029: Types and aliases cannot be named 'required'. // class required {} Diagnostic(ErrorCode.ERR_RequiredNameDisallowed, "required").WithLocation(35, 11) } @@ -523,7 +523,7 @@ class Derived : Base var comp = CreateCompilationWithRequiredMembers(@base + derived); comp.VerifyDiagnostics( - // (8,25): error CS9501: 'Derived.Prop' must be required because it overrides required member 'Base.Prop' + // (8,25): error CS9030: 'Derived.Prop' must be required because it overrides required member 'Base.Prop' // public override int Prop { get; set; } Diagnostic(ErrorCode.ERR_OverrideMustHaveRequired, "Prop").WithArguments("Derived.Prop", "Base.Prop").WithLocation(8, 25) ); @@ -533,7 +533,7 @@ class Derived : Base comp = CreateCompilation(derived, references: new[] { useMetadataReference ? baseComp.ToMetadataReference() : baseComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (4,25): error CS9501: 'Derived.Prop' must be required because it overrides required member 'Base.Prop' + // (4,25): error CS9030: 'Derived.Prop' must be required because it overrides required member 'Base.Prop' // public override int Prop { get; set; } Diagnostic(ErrorCode.ERR_OverrideMustHaveRequired, "Prop").WithArguments("Derived.Prop", "Base.Prop").WithLocation(4, 25) ); @@ -565,7 +565,7 @@ class DerivedDerived : Derived var comp = CreateCompilationWithRequiredMembers(@base + derived + derivedDerived); comp.VerifyDiagnostics( - // (12,25): error CS9501: 'DerivedDerived.Prop' must be required because it overrides required member 'Derived.Prop' + // (12,25): error CS9030: 'DerivedDerived.Prop' must be required because it overrides required member 'Derived.Prop' // public override int Prop { get; set; } Diagnostic(ErrorCode.ERR_OverrideMustHaveRequired, "Prop").WithArguments("DerivedDerived.Prop", "Derived.Prop").WithLocation(12, 25) ); @@ -579,7 +579,7 @@ class DerivedDerived : Derived comp = CreateCompilation(derivedDerived, new[] { baseReference, useMetadataReference ? derivedComp.ToMetadataReference() : derivedComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (4,25): error CS9501: 'DerivedDerived.Prop' must be required because it overrides required member 'Derived.Prop' + // (4,25): error CS9030: 'DerivedDerived.Prop' must be required because it overrides required member 'Derived.Prop' // public override int Prop { get; set; } Diagnostic(ErrorCode.ERR_OverrideMustHaveRequired, "Prop").WithArguments("DerivedDerived.Prop", "Derived.Prop").WithLocation(4, 25) ); @@ -796,25 +796,25 @@ class Derived3 : Base var comp = CreateCompilationWithRequiredMembers(@base + derived); comp.VerifyDiagnostics( - // (10,20): error CS9502: Required member 'Base.Field' cannot be hidden by 'Derived1.Field'. + // (10,20): error CS9031: Required member 'Base.Field' cannot be hidden by 'Derived1.Field'. // public new int Field; // 1 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeHidden, "Field").WithArguments("Base.Field", "Derived1.Field").WithLocation(10, 20), - // (11,20): error CS9502: Required member 'Base.Prop' cannot be hidden by 'Derived1.Prop'. + // (11,20): error CS9031: Required member 'Base.Prop' cannot be hidden by 'Derived1.Prop'. // public new int Prop { get; set; } // 2 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeHidden, "Prop").WithArguments("Base.Prop", "Derived1.Prop").WithLocation(11, 20), - // (15,20): error CS9502: Required member 'Base.Prop' cannot be hidden by 'Derived2.Prop'. + // (15,20): error CS9031: Required member 'Base.Prop' cannot be hidden by 'Derived2.Prop'. // public new int Prop; // 3 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeHidden, "Prop").WithArguments("Base.Prop", "Derived2.Prop").WithLocation(15, 20), - // (16,20): error CS9502: Required member 'Base.Field' cannot be hidden by 'Derived2.Field'. + // (16,20): error CS9031: Required member 'Base.Field' cannot be hidden by 'Derived2.Field'. // public new int Field { get; set; } // 4 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeHidden, "Field").WithArguments("Base.Field", "Derived2.Field").WithLocation(16, 20), // (20,16): warning CS0108: 'Derived3.Field' hides inherited member 'Base.Field'. Use the new keyword if hiding was intended. // public int Field; // 1 Diagnostic(ErrorCode.WRN_NewRequired, "Field").WithArguments("Derived3.Field", "Base.Field").WithLocation(20, 16), - // (20,16): error CS9502: Required member 'Base.Field' cannot be hidden by 'Derived3.Field'. + // (20,16): error CS9031: Required member 'Base.Field' cannot be hidden by 'Derived3.Field'. // public int Field; // 1 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeHidden, "Field").WithArguments("Base.Field", "Derived3.Field").WithLocation(20, 16), - // (21,16): error CS9502: Required member 'Base.Prop' cannot be hidden by 'Derived3.Prop'. + // (21,16): error CS9031: Required member 'Base.Prop' cannot be hidden by 'Derived3.Prop'. // public int Prop { get; set; } // 2 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeHidden, "Prop").WithArguments("Base.Prop", "Derived3.Prop").WithLocation(21, 16) ); @@ -824,25 +824,25 @@ class Derived3 : Base comp = CreateCompilation("#pragma warning disable CS0649 // Never assigned" + derived, new[] { useMetadataReference ? baseComp.ToMetadataReference() : baseComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (4,20): error CS9502: Required member 'Base.Field' cannot be hidden by 'Derived1.Field'. + // (4,20): error CS9031: Required member 'Base.Field' cannot be hidden by 'Derived1.Field'. // public new int Field; // 1 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeHidden, "Field").WithArguments("Base.Field", "Derived1.Field").WithLocation(4, 20), - // (5,20): error CS9502: Required member 'Base.Prop' cannot be hidden by 'Derived1.Prop'. + // (5,20): error CS9031: Required member 'Base.Prop' cannot be hidden by 'Derived1.Prop'. // public new int Prop { get; set; } // 2 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeHidden, "Prop").WithArguments("Base.Prop", "Derived1.Prop").WithLocation(5, 20), - // (9,20): error CS9502: Required member 'Base.Prop' cannot be hidden by 'Derived2.Prop'. + // (9,20): error CS9031: Required member 'Base.Prop' cannot be hidden by 'Derived2.Prop'. // public new int Prop; // 3 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeHidden, "Prop").WithArguments("Base.Prop", "Derived2.Prop").WithLocation(9, 20), - // (10,20): error CS9502: Required member 'Base.Field' cannot be hidden by 'Derived2.Field'. + // (10,20): error CS9031: Required member 'Base.Field' cannot be hidden by 'Derived2.Field'. // public new int Field { get; set; } // 4 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeHidden, "Field").WithArguments("Base.Field", "Derived2.Field").WithLocation(10, 20), // (14,16): warning CS0108: 'Derived3.Field' hides inherited member 'Base.Field'. Use the new keyword if hiding was intended. // public int Field; // 1 Diagnostic(ErrorCode.WRN_NewRequired, "Field").WithArguments("Derived3.Field", "Base.Field").WithLocation(14, 16), - // (14,16): error CS9502: Required member 'Base.Field' cannot be hidden by 'Derived3.Field'. + // (14,16): error CS9031: Required member 'Base.Field' cannot be hidden by 'Derived3.Field'. // public int Field; // 1 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeHidden, "Field").WithArguments("Base.Field", "Derived3.Field").WithLocation(14, 16), - // (15,16): error CS9502: Required member 'Base.Prop' cannot be hidden by 'Derived3.Prop'. + // (15,16): error CS9031: Required member 'Base.Prop' cannot be hidden by 'Derived3.Prop'. // public int Prop { get; set; } // 2 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeHidden, "Prop").WithArguments("Base.Prop", "Derived3.Prop").WithLocation(15, 16) ); @@ -950,94 +950,94 @@ private class PrivateClass "); comp.VerifyDiagnostics( - // (7,37): error CS9503: Required member 'PublicClass.InternalProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (7,37): error CS9032: Required member 'PublicClass.InternalProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // internal protected required int InternalProtectedProperty { get; set; } // 1 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "InternalProtectedProperty").WithArguments("PublicClass.InternalProtectedProperty", "PublicClass").WithLocation(7, 37), - // (8,27): error CS9503: Required member 'PublicClass.InternalProperty' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (8,27): error CS9032: Required member 'PublicClass.InternalProperty' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // internal required int InternalProperty { get; set; } // 2 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "InternalProperty").WithArguments("PublicClass.InternalProperty", "PublicClass").WithLocation(8, 27), - // (9,28): error CS9503: Required member 'PublicClass.ProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (9,28): error CS9032: Required member 'PublicClass.ProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // protected required int ProtectedProperty { get; set; } // 3 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "ProtectedProperty").WithArguments("PublicClass.ProtectedProperty", "PublicClass").WithLocation(9, 28), - // (10,36): error CS9503: Required member 'PublicClass.PrivateProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (10,36): error CS9032: Required member 'PublicClass.PrivateProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // private protected required int PrivateProtectedProperty { get; set; } // 4 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProtectedProperty").WithArguments("PublicClass.PrivateProtectedProperty", "PublicClass").WithLocation(10, 36), - // (11,26): error CS9503: Required member 'PublicClass.PrivateProperty' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (11,26): error CS9032: Required member 'PublicClass.PrivateProperty' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // private required int PrivateProperty { get; set; } // 5 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProperty").WithArguments("PublicClass.PrivateProperty", "PublicClass").WithLocation(11, 26), - // (13,37): error CS9503: Required member 'PublicClass.InternalProtectedField' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (13,37): error CS9032: Required member 'PublicClass.InternalProtectedField' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // internal protected required int InternalProtectedField; // 6 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "InternalProtectedField").WithArguments("PublicClass.InternalProtectedField", "PublicClass").WithLocation(13, 37), - // (14,27): error CS9503: Required member 'PublicClass.InternalField' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (14,27): error CS9032: Required member 'PublicClass.InternalField' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // internal required int InternalField; // 7 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "InternalField").WithArguments("PublicClass.InternalField", "PublicClass").WithLocation(14, 27), - // (15,28): error CS9503: Required member 'PublicClass.ProtectedField' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (15,28): error CS9032: Required member 'PublicClass.ProtectedField' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // protected required int ProtectedField; // 8 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "ProtectedField").WithArguments("PublicClass.ProtectedField", "PublicClass").WithLocation(15, 28), - // (16,36): error CS9503: Required member 'PublicClass.PrivateProtectedField' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (16,36): error CS9032: Required member 'PublicClass.PrivateProtectedField' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // private protected required int PrivateProtectedField; // 9 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProtectedField").WithArguments("PublicClass.PrivateProtectedField", "PublicClass").WithLocation(16, 36), - // (17,26): error CS9503: Required member 'PublicClass.PrivateField' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (17,26): error CS9032: Required member 'PublicClass.PrivateField' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // private required int PrivateField; // 10 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateField").WithArguments("PublicClass.PrivateField", "PublicClass").WithLocation(17, 26), - // (24,28): error CS9503: Required member 'InternalClass.ProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. + // (24,28): error CS9032: Required member 'InternalClass.ProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. // protected required int ProtectedProperty { get; set; } // 11 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "ProtectedProperty").WithArguments("InternalClass.ProtectedProperty", "InternalClass").WithLocation(24, 28), - // (25,36): error CS9503: Required member 'InternalClass.PrivateProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. + // (25,36): error CS9032: Required member 'InternalClass.PrivateProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. // private protected required int PrivateProtectedProperty { get; set; } // 12 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProtectedProperty").WithArguments("InternalClass.PrivateProtectedProperty", "InternalClass").WithLocation(25, 36), - // (26,26): error CS9503: Required member 'InternalClass.PrivateProperty' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. + // (26,26): error CS9032: Required member 'InternalClass.PrivateProperty' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. // private required int PrivateProperty { get; set; } // 13 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProperty").WithArguments("InternalClass.PrivateProperty", "InternalClass").WithLocation(26, 26), - // (30,28): error CS9503: Required member 'InternalClass.ProtectedField' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. + // (30,28): error CS9032: Required member 'InternalClass.ProtectedField' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. // protected required int ProtectedField; // 14 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "ProtectedField").WithArguments("InternalClass.ProtectedField", "InternalClass").WithLocation(30, 28), - // (31,36): error CS9503: Required member 'InternalClass.PrivateProtectedField' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. + // (31,36): error CS9032: Required member 'InternalClass.PrivateProtectedField' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. // private protected required int PrivateProtectedField; // 15 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProtectedField").WithArguments("InternalClass.PrivateProtectedField", "InternalClass").WithLocation(31, 36), - // (32,26): error CS9503: Required member 'InternalClass.PrivateField' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. + // (32,26): error CS9032: Required member 'InternalClass.PrivateField' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. // private required int PrivateField; // 16 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateField").WithArguments("InternalClass.PrivateField", "InternalClass").WithLocation(32, 26), - // (40,31): error CS9503: Required member 'Outer.ProtectedInternalClass.InternalProperty' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. + // (40,31): error CS9032: Required member 'Outer.ProtectedInternalClass.InternalProperty' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. // internal required int InternalProperty { get; set; } // 17 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "InternalProperty").WithArguments("Outer.ProtectedInternalClass.InternalProperty", "Outer.ProtectedInternalClass").WithLocation(40, 31), - // (41,32): error CS9503: Required member 'Outer.ProtectedInternalClass.ProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. + // (41,32): error CS9032: Required member 'Outer.ProtectedInternalClass.ProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. // protected required int ProtectedProperty { get; set; } // 18 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "ProtectedProperty").WithArguments("Outer.ProtectedInternalClass.ProtectedProperty", "Outer.ProtectedInternalClass").WithLocation(41, 32), - // (42,40): error CS9503: Required member 'Outer.ProtectedInternalClass.PrivateProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. + // (42,40): error CS9032: Required member 'Outer.ProtectedInternalClass.PrivateProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. // private protected required int PrivateProtectedProperty { get; set; } // 19 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProtectedProperty").WithArguments("Outer.ProtectedInternalClass.PrivateProtectedProperty", "Outer.ProtectedInternalClass").WithLocation(42, 40), - // (43,30): error CS9503: Required member 'Outer.ProtectedInternalClass.PrivateProperty' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. + // (43,30): error CS9032: Required member 'Outer.ProtectedInternalClass.PrivateProperty' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. // private required int PrivateProperty { get; set; } // 20 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProperty").WithArguments("Outer.ProtectedInternalClass.PrivateProperty", "Outer.ProtectedInternalClass").WithLocation(43, 30), - // (46,31): error CS9503: Required member 'Outer.ProtectedInternalClass.InternalField' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. + // (46,31): error CS9032: Required member 'Outer.ProtectedInternalClass.InternalField' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. // internal required int InternalField; // 21 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "InternalField").WithArguments("Outer.ProtectedInternalClass.InternalField", "Outer.ProtectedInternalClass").WithLocation(46, 31), - // (47,32): error CS9503: Required member 'Outer.ProtectedInternalClass.ProtectedField' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. + // (47,32): error CS9032: Required member 'Outer.ProtectedInternalClass.ProtectedField' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. // protected required int ProtectedField; // 22 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "ProtectedField").WithArguments("Outer.ProtectedInternalClass.ProtectedField", "Outer.ProtectedInternalClass").WithLocation(47, 32), - // (48,40): error CS9503: Required member 'Outer.ProtectedInternalClass.PrivateProtectedField' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. + // (48,40): error CS9032: Required member 'Outer.ProtectedInternalClass.PrivateProtectedField' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. // private protected required int PrivateProtectedField; // 23 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProtectedField").WithArguments("Outer.ProtectedInternalClass.PrivateProtectedField", "Outer.ProtectedInternalClass").WithLocation(48, 40), - // (49,30): error CS9503: Required member 'Outer.ProtectedInternalClass.PrivateField' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. + // (49,30): error CS9032: Required member 'Outer.ProtectedInternalClass.PrivateField' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedInternalClass'. // private required int PrivateField; // 24 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateField").WithArguments("Outer.ProtectedInternalClass.PrivateField", "Outer.ProtectedInternalClass").WithLocation(49, 30), - // (57,40): error CS9503: Required member 'Outer.ProtectedClass.PrivateProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedClass'. + // (57,40): error CS9032: Required member 'Outer.ProtectedClass.PrivateProtectedProperty' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedClass'. // private protected required int PrivateProtectedProperty { get; set; } // 25 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProtectedProperty").WithArguments("Outer.ProtectedClass.PrivateProtectedProperty", "Outer.ProtectedClass").WithLocation(57, 40), - // (58,30): error CS9503: Required member 'Outer.ProtectedClass.PrivateProperty' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedClass'. + // (58,30): error CS9032: Required member 'Outer.ProtectedClass.PrivateProperty' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedClass'. // private required int PrivateProperty { get; set; } // 26 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProperty").WithArguments("Outer.ProtectedClass.PrivateProperty", "Outer.ProtectedClass").WithLocation(58, 30), - // (63,40): error CS9503: Required member 'Outer.ProtectedClass.PrivateProtectedField' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedClass'. + // (63,40): error CS9032: Required member 'Outer.ProtectedClass.PrivateProtectedField' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedClass'. // private protected required int PrivateProtectedField; // 27 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProtectedField").WithArguments("Outer.ProtectedClass.PrivateProtectedField", "Outer.ProtectedClass").WithLocation(63, 40), - // (64,30): error CS9503: Required member 'Outer.ProtectedClass.PrivateField' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedClass'. + // (64,30): error CS9032: Required member 'Outer.ProtectedClass.PrivateField' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedClass'. // private required int PrivateField; // 28 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateField").WithArguments("Outer.ProtectedClass.PrivateField", "Outer.ProtectedClass").WithLocation(64, 30), - // (73,30): error CS9503: Required member 'Outer.PrivateProtectedClass.PrivateProperty' cannot be less visible or have a setter less visible than the containing type 'Outer.PrivateProtectedClass'. + // (73,30): error CS9032: Required member 'Outer.PrivateProtectedClass.PrivateProperty' cannot be less visible or have a setter less visible than the containing type 'Outer.PrivateProtectedClass'. // private required int PrivateProperty { get; set; } // 29 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProperty").WithArguments("Outer.PrivateProtectedClass.PrivateProperty", "Outer.PrivateProtectedClass").WithLocation(73, 30), - // (79,30): error CS9503: Required member 'Outer.PrivateProtectedClass.PrivateField' cannot be less visible or have a setter less visible than the containing type 'Outer.PrivateProtectedClass'. + // (79,30): error CS9032: Required member 'Outer.PrivateProtectedClass.PrivateField' cannot be less visible or have a setter less visible than the containing type 'Outer.PrivateProtectedClass'. // private required int PrivateField; // 30 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateField").WithArguments("Outer.PrivateProtectedClass.PrivateField", "Outer.PrivateProtectedClass").WithLocation(79, 30) ); @@ -1101,49 +1101,49 @@ private class PrivateClass "); comp.VerifyDiagnostics( - // (4,25): error CS9503: Required member 'PublicClass.InternalProtected' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (4,25): error CS9032: Required member 'PublicClass.InternalProtected' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // public required int InternalProtected { get; internal protected set; } // 1 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "InternalProtected").WithArguments("PublicClass.InternalProtected", "PublicClass").WithLocation(4, 25), - // (5,25): error CS9503: Required member 'PublicClass.Internal' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (5,25): error CS9032: Required member 'PublicClass.Internal' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // public required int Internal { get; internal set; } // 2 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "Internal").WithArguments("PublicClass.Internal", "PublicClass").WithLocation(5, 25), - // (6,25): error CS9503: Required member 'PublicClass.Protected' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (6,25): error CS9032: Required member 'PublicClass.Protected' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // public required int Protected { get; protected set; } // 3 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "Protected").WithArguments("PublicClass.Protected", "PublicClass").WithLocation(6, 25), - // (7,25): error CS9503: Required member 'PublicClass.PrivateProtected' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (7,25): error CS9032: Required member 'PublicClass.PrivateProtected' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // public required int PrivateProtected { get; private protected set; } // 4 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProtected").WithArguments("PublicClass.PrivateProtected", "PublicClass").WithLocation(7, 25), - // (8,25): error CS9503: Required member 'PublicClass.Private' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. + // (8,25): error CS9032: Required member 'PublicClass.Private' cannot be less visible or have a setter less visible than the containing type 'PublicClass'. // public required int Private { get; private set; } // 5 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "Private").WithArguments("PublicClass.Private", "PublicClass").WithLocation(8, 25), - // (14,25): error CS9503: Required member 'InternalClass.Protected' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. + // (14,25): error CS9032: Required member 'InternalClass.Protected' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. // public required int Protected { get; protected set; } // 6 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "Protected").WithArguments("InternalClass.Protected", "InternalClass").WithLocation(14, 25), - // (15,25): error CS9503: Required member 'InternalClass.PrivateProtected' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. + // (15,25): error CS9032: Required member 'InternalClass.PrivateProtected' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. // public required int PrivateProtected { get; private protected set; } // 7 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProtected").WithArguments("InternalClass.PrivateProtected", "InternalClass").WithLocation(15, 25), - // (16,25): error CS9503: Required member 'InternalClass.Private' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. + // (16,25): error CS9032: Required member 'InternalClass.Private' cannot be less visible or have a setter less visible than the containing type 'InternalClass'. // public required int Private { get; private set; } // 8 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "Private").WithArguments("InternalClass.Private", "InternalClass").WithLocation(16, 25), - // (23,29): error CS9503: Required member 'Outer.InternalProtectedClass.Internal' cannot be less visible or have a setter less visible than the containing type 'Outer.InternalProtectedClass'. + // (23,29): error CS9032: Required member 'Outer.InternalProtectedClass.Internal' cannot be less visible or have a setter less visible than the containing type 'Outer.InternalProtectedClass'. // public required int Internal { get; internal set; } // 9 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "Internal").WithArguments("Outer.InternalProtectedClass.Internal", "Outer.InternalProtectedClass").WithLocation(23, 29), - // (24,29): error CS9503: Required member 'Outer.InternalProtectedClass.Protected' cannot be less visible or have a setter less visible than the containing type 'Outer.InternalProtectedClass'. + // (24,29): error CS9032: Required member 'Outer.InternalProtectedClass.Protected' cannot be less visible or have a setter less visible than the containing type 'Outer.InternalProtectedClass'. // public required int Protected { get; protected set; } // 10 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "Protected").WithArguments("Outer.InternalProtectedClass.Protected", "Outer.InternalProtectedClass").WithLocation(24, 29), - // (25,29): error CS9503: Required member 'Outer.InternalProtectedClass.PrivateProtected' cannot be less visible or have a setter less visible than the containing type 'Outer.InternalProtectedClass'. + // (25,29): error CS9032: Required member 'Outer.InternalProtectedClass.PrivateProtected' cannot be less visible or have a setter less visible than the containing type 'Outer.InternalProtectedClass'. // public required int PrivateProtected { get; private protected set; } // 11 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProtected").WithArguments("Outer.InternalProtectedClass.PrivateProtected", "Outer.InternalProtectedClass").WithLocation(25, 29), - // (26,29): error CS9503: Required member 'Outer.InternalProtectedClass.Private' cannot be less visible or have a setter less visible than the containing type 'Outer.InternalProtectedClass'. + // (26,29): error CS9032: Required member 'Outer.InternalProtectedClass.Private' cannot be less visible or have a setter less visible than the containing type 'Outer.InternalProtectedClass'. // public required int Private { get; private set; } // 12 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "Private").WithArguments("Outer.InternalProtectedClass.Private", "Outer.InternalProtectedClass").WithLocation(26, 29), - // (33,29): error CS9503: Required member 'Outer.ProtectedClass.PrivateProtected' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedClass'. + // (33,29): error CS9032: Required member 'Outer.ProtectedClass.PrivateProtected' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedClass'. // public required int PrivateProtected { get; private protected set; } // 13 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "PrivateProtected").WithArguments("Outer.ProtectedClass.PrivateProtected", "Outer.ProtectedClass").WithLocation(33, 29), - // (34,29): error CS9503: Required member 'Outer.ProtectedClass.Private' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedClass'. + // (34,29): error CS9032: Required member 'Outer.ProtectedClass.Private' cannot be less visible or have a setter less visible than the containing type 'Outer.ProtectedClass'. // public required int Private { get; private set; } // 14 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "Private").WithArguments("Outer.ProtectedClass.Private", "Outer.ProtectedClass").WithLocation(34, 29), - // (42,29): error CS9503: Required member 'Outer.PrivateProtectedClass.Private' cannot be less visible or have a setter less visible than the containing type 'Outer.PrivateProtectedClass'. + // (42,29): error CS9032: Required member 'Outer.PrivateProtectedClass.Private' cannot be less visible or have a setter less visible than the containing type 'Outer.PrivateProtectedClass'. // public required int Private { get; private set; } // 15 Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "Private").WithArguments("Outer.PrivateProtectedClass.Private", "Outer.PrivateProtectedClass").WithLocation(42, 29) ); @@ -1165,13 +1165,13 @@ class C "); comp.VerifyDiagnostics( - // (3,2): error CS9504: Do not use 'System.Runtime.CompilerServices.RequiredMemberAttribute'. Use the 'required' keyword on required fields and properties instead. + // (3,2): error CS9033: Do not use 'System.Runtime.CompilerServices.RequiredMemberAttribute'. Use the 'required' keyword on required fields and properties instead. // [RequiredMember] Diagnostic(ErrorCode.ERR_ExplicitRequiredMember, "RequiredMember").WithLocation(3, 2), - // (6,6): error CS9504: Do not use 'System.Runtime.CompilerServices.RequiredMemberAttribute'. Use the 'required' keyword on required fields and properties instead. + // (6,6): error CS9033: Do not use 'System.Runtime.CompilerServices.RequiredMemberAttribute'. Use the 'required' keyword on required fields and properties instead. // [RequiredMember] Diagnostic(ErrorCode.ERR_ExplicitRequiredMember, "RequiredMember").WithLocation(6, 6), - // (8,6): error CS9504: Do not use 'System.Runtime.CompilerServices.RequiredMemberAttribute'. Use the 'required' keyword on required fields and properties instead. + // (8,6): error CS9033: Do not use 'System.Runtime.CompilerServices.RequiredMemberAttribute'. Use the 'required' keyword on required fields and properties instead. // [RequiredMember] Diagnostic(ErrorCode.ERR_ExplicitRequiredMember, "RequiredMember").WithLocation(8, 6), // (9,16): warning CS0649: Field 'C.Field' is never assigned to, and will always have its default value 0 @@ -1248,16 +1248,16 @@ class C "); comp.VerifyDiagnostics( - // (5,29): error CS9505: Required member 'C.Prop1' must be settable. + // (5,29): error CS9034: Required member 'C.Prop1' must be settable. // public required ref int Prop1 => ref i; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSettable, "Prop1").WithArguments("C.Prop1").WithLocation(5, 29), - // (5,29): error CS9514: Ref returning properties cannot be required. + // (5,29): error CS9043: Ref returning properties cannot be required. // public required ref int Prop1 => ref i; Diagnostic(ErrorCode.ERR_RefReturningPropertiesCannotBeRequired, "Prop1").WithLocation(5, 29), - // (6,38): error CS9505: Required member 'C.Prop2' must be settable. + // (6,38): error CS9034: Required member 'C.Prop2' must be settable. // public required ref readonly int Prop2 => ref i; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSettable, "Prop2").WithArguments("C.Prop2").WithLocation(6, 38), - // (6,38): error CS9514: Ref returning properties cannot be required. + // (6,38): error CS9043: Ref returning properties cannot be required. // public required ref readonly int Prop2 => ref i; Diagnostic(ErrorCode.ERR_RefReturningPropertiesCannotBeRequired, "Prop2").WithLocation(6, 38) ); @@ -1282,13 +1282,13 @@ public class C """); comp.VerifyDiagnostics( - // (4,34): error CS9505: Required member 'C.Field' must be settable. + // (4,34): error CS9034: Required member 'C.Field' must be settable. // public required readonly int Field; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSettable, "Field").WithArguments("C.Field").WithLocation(4, 34), - // (5,25): error CS9505: Required member 'C.Prop1' must be settable. + // (5,25): error CS9034: Required member 'C.Prop1' must be settable. // public required int Prop1 { get; } Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSettable, "Prop1").WithArguments("C.Prop1").WithLocation(5, 25), - // (6,25): error CS9503: Required member 'C.Prop2' cannot be less visible or have a setter less visible than the containing type 'C'. + // (6,25): error CS9032: Required member 'C.Prop2' cannot be less visible or have a setter less visible than the containing type 'C'. // public required int Prop2 { get; private set; } Diagnostic(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, "Prop2").WithArguments("C.Prop2", "C").WithLocation(6, 25) ); @@ -1310,10 +1310,10 @@ class C """); comp.VerifyDiagnostics( - // (6,25): warning CS9513: Required member 'C.Field' should not be attributed with 'ObsoleteAttribute' unless the containing type is obsolete or all constructors are obsolete. + // (6,25): warning CS9042: Required member 'C.Field' should not be attributed with 'ObsoleteAttribute' unless the containing type is obsolete or all constructors are obsolete. // public required int Field; Diagnostic(ErrorCode.WRN_ObsoleteMembersShouldNotBeRequired, "Field").WithArguments("C.Field").WithLocation(6, 25), - // (8,25): warning CS9513: Required member 'C.Prop1' should not be attributed with 'ObsoleteAttribute' unless the containing type is obsolete or all constructors are obsolete. + // (8,25): warning CS9042: Required member 'C.Prop1' should not be attributed with 'ObsoleteAttribute' unless the containing type is obsolete or all constructors are obsolete. // public required int Prop1 { get; set; } Diagnostic(ErrorCode.WRN_ObsoleteMembersShouldNotBeRequired, "Prop1").WithArguments("C.Prop1").WithLocation(8, 25) ); @@ -1335,10 +1335,10 @@ struct S """); comp.VerifyDiagnostics( - // (6,25): warning CS9513: Required member 'S.Field' should not be attributed with 'ObsoleteAttribute' unless the containing type is obsolete or all constructors are obsolete. + // (6,25): warning CS9042: Required member 'S.Field' should not be attributed with 'ObsoleteAttribute' unless the containing type is obsolete or all constructors are obsolete. // public required int Field; Diagnostic(ErrorCode.WRN_ObsoleteMembersShouldNotBeRequired, "Field").WithArguments("S.Field").WithLocation(6, 25), - // (8,25): warning CS9513: Required member 'S.Prop1' should not be attributed with 'ObsoleteAttribute' unless the containing type is obsolete or all constructors are obsolete. + // (8,25): warning CS9042: Required member 'S.Prop1' should not be attributed with 'ObsoleteAttribute' unless the containing type is obsolete or all constructors are obsolete. // public required int Prop1 { get; set; } Diagnostic(ErrorCode.WRN_ObsoleteMembersShouldNotBeRequired, "Prop1").WithArguments("S.Prop1").WithLocation(8, 25) ); @@ -1413,10 +1413,10 @@ public C(bool b) { } """); comp.VerifyDiagnostics( - // (14,25): warning CS9513: Required member 'C.Field' should not be attributed with 'ObsoleteAttribute' unless the containing type is obsolete or all constructors are obsolete. + // (14,25): warning CS9042: Required member 'C.Field' should not be attributed with 'ObsoleteAttribute' unless the containing type is obsolete or all constructors are obsolete. // public required int Field; Diagnostic(ErrorCode.WRN_ObsoleteMembersShouldNotBeRequired, "Field").WithArguments("C.Field").WithLocation(14, 25), - // (16,25): warning CS9513: Required member 'C.Prop1' should not be attributed with 'ObsoleteAttribute' unless the containing type is obsolete or all constructors are obsolete. + // (16,25): warning CS9042: Required member 'C.Prop1' should not be attributed with 'ObsoleteAttribute' unless the containing type is obsolete or all constructors are obsolete. // public required int Prop1 { get; set; } Diagnostic(ErrorCode.WRN_ObsoleteMembersShouldNotBeRequired, "Prop1").WithArguments("C.Prop1").WithLocation(16, 25) ); @@ -1460,18 +1460,18 @@ public class C var expectedDiagnostics = constructor == " C" ? new[] { - // (1,11): error CS9506: Required member 'C.Prop' must be set in the object initializer or attribute constructor. + // (1,11): error CS9035: Required member 'C.Prop' must be set in the object initializer or attribute constructor. // C c = new C(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "C").WithArguments("C.Prop").WithLocation(1, 11), - // (1,11): error CS9506: Required member 'C.Field' must be set in the object initializer or attribute constructor. + // (1,11): error CS9035: Required member 'C.Field' must be set in the object initializer or attribute constructor. // C c = new C(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "C").WithArguments("C.Field").WithLocation(1, 11) } : new[] { - // (1,7): error CS9506: Required member 'C.Prop' must be set in the object initializer or attribute constructor. + // (1,7): error CS9035: Required member 'C.Prop' must be set in the object initializer or attribute constructor. // C c = new(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "new").WithArguments("C.Prop").WithLocation(1, 7), - // (1,7): error CS9506: Required member 'C.Field' must be set in the object initializer or attribute constructor. + // (1,7): error CS9035: Required member 'C.Field' must be set in the object initializer or attribute constructor. // C c = new(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "new").WithArguments("C.Field").WithLocation(1, 7) }; @@ -1530,18 +1530,18 @@ public class C var expectedDiagnostics = constructor == " C" ? new[] { - // (1,11): error CS9506: Required member 'C.Prop1' must be set in the object initializer or attribute constructor. + // (1,11): error CS9035: Required member 'C.Prop1' must be set in the object initializer or attribute constructor. // C c = new C() { Prop2 = 1, Field2 = 1 }; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "C").WithArguments("C.Prop1").WithLocation(1, 11), - // (1,11): error CS9506: Required member 'C.Field1' must be set in the object initializer or attribute constructor. + // (1,11): error CS9035: Required member 'C.Field1' must be set in the object initializer or attribute constructor. // C c = new C() { Prop2 = 1, Field2 = 1 }; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "C").WithArguments("C.Field1").WithLocation(1, 11) } : new[] { - // (1,7): error CS9506: Required member 'C.Prop1' must be set in the object initializer or attribute constructor. + // (1,7): error CS9035: Required member 'C.Prop1' must be set in the object initializer or attribute constructor. // C c = new() { Prop2 = 1, Field2 = 1 }; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "new").WithArguments("C.Prop1").WithLocation(1, 7), - // (1,7): error CS9506: Required member 'C.Field1' must be set in the object initializer or attribute constructor. + // (1,7): error CS9035: Required member 'C.Field1' must be set in the object initializer or attribute constructor. // C c = new() { Prop2 = 1, Field2 = 1 }; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "new").WithArguments("C.Field1").WithLocation(1, 7) }; @@ -1593,10 +1593,10 @@ public class C "; var comp = CreateCompilationWithRequiredMembers(c); comp.VerifyDiagnostics( - // (2,13): error CS9506: Required member 'C.Prop1' must be set in the object initializer or attribute constructor. + // (2,13): error CS9035: Required member 'C.Prop1' must be set in the object initializer or attribute constructor. // var c = new C(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "C").WithArguments("C.Prop1").WithLocation(2, 13), - // (2,13): error CS9506: Required member 'C.Field1' must be set in the object initializer or attribute constructor. + // (2,13): error CS9035: Required member 'C.Field1' must be set in the object initializer or attribute constructor. // var c = new C(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "C").WithArguments("C.Field1").WithLocation(2, 13), // (3,15): error CS0200: Property or indexer 'C.Prop1' cannot be assigned to -- it is read only @@ -1605,10 +1605,10 @@ public class C // (3,26): error CS0191: A readonly field cannot be assigned to (except in a constructor or init-only setter of the type in which the field is defined or a variable initializer) // c = new C() { Prop1 = 1, Field1 = 1 }; Diagnostic(ErrorCode.ERR_AssgReadonly, "Field1").WithLocation(3, 26), - // (7,25): error CS9505: Required member 'C.Prop1' must be settable. + // (7,25): error CS9034: Required member 'C.Prop1' must be settable. // public required int Prop1 { get; } Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSettable, "Prop1").WithArguments("C.Prop1").WithLocation(7, 25), - // (8,34): error CS9505: Required member 'C.Field1' must be settable. + // (8,34): error CS9034: Required member 'C.Field1' must be settable. // public required readonly int Field1; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSettable, "Field1").WithArguments("C.Field1").WithLocation(8, 34) ); @@ -1638,10 +1638,10 @@ End Class "; var comp = CreateCompilation(new[] { c }, references: new[] { vbComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (2,13): error CS9506: Required member 'C.Prop1' must be set in the object initializer or attribute constructor. + // (2,13): error CS9035: Required member 'C.Prop1' must be set in the object initializer or attribute constructor. // var c = new C(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "C").WithArguments("C.Prop1").WithLocation(2, 13), - // (2,13): error CS9506: Required member 'C.Field1' must be set in the object initializer or attribute constructor. + // (2,13): error CS9035: Required member 'C.Field1' must be set in the object initializer or attribute constructor. // var c = new C(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "C").WithArguments("C.Field1").WithLocation(2, 13), // (3,15): error CS0200: Property or indexer 'C.Prop1' cannot be assigned to -- it is read only @@ -1678,10 +1678,10 @@ public C() {} // (4,26): error CS0191: A readonly field cannot be assigned to (except in a constructor or init-only setter of the type in which the field is defined or a variable initializer) // c = new C() { Prop1 = 1, Field1 = 1 }; Diagnostic(ErrorCode.ERR_AssgReadonly, "Field1").WithLocation(4, 26), - // (8,25): error CS9505: Required member 'C.Prop1' must be settable. + // (8,25): error CS9034: Required member 'C.Prop1' must be settable. // public required int Prop1 { get; } Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSettable, "Prop1").WithArguments("C.Prop1").WithLocation(8, 25), - // (9,34): error CS9505: Required member 'C.Field1' must be settable. + // (9,34): error CS9034: Required member 'C.Field1' must be settable. // public required readonly int Field1; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSettable, "Field1").WithArguments("C.Field1").WithLocation(9, 34) ); @@ -1705,10 +1705,10 @@ public class D "; var comp = CreateCompilationWithRequiredMembers(c); comp.VerifyDiagnostics( - // (2,24): error CS9507: Required member 'C.D1' must be assigned a value, it cannot use a nested member or collection initializer. + // (2,24): error CS9036: Required member 'C.D1' must be assigned a value, it cannot use a nested member or collection initializer. // var c = new C() { D1 = { NestedProp = 1 }, D2 = { NestedProp = 2 } }; Diagnostic(ErrorCode.ERR_RequiredMembersMustBeAssignedValue, "{ NestedProp = 1 }").WithArguments("C.D1").WithLocation(2, 24), - // (2,49): error CS9507: Required member 'C.D2' must be assigned a value, it cannot use a nested member or collection initializer. + // (2,49): error CS9036: Required member 'C.D2' must be assigned a value, it cannot use a nested member or collection initializer. // var c = new C() { D1 = { NestedProp = 1 }, D2 = { NestedProp = 2 } }; Diagnostic(ErrorCode.ERR_RequiredMembersMustBeAssignedValue, "{ NestedProp = 2 }").WithArguments("C.D2").WithLocation(2, 49) ); @@ -1773,10 +1773,10 @@ public class C "; var comp = CreateCompilationWithRequiredMembers(c); comp.VerifyDiagnostics( - // (3,24): error CS9507: Required member 'C.L1' must be assigned a value, it cannot use a nested member or collection initializer. + // (3,24): error CS9036: Required member 'C.L1' must be assigned a value, it cannot use a nested member or collection initializer. // var c = new C() { L1 = { 1, 2, 3 }, L2 = { 4, 5, 6 } }; Diagnostic(ErrorCode.ERR_RequiredMembersMustBeAssignedValue, "{ 1, 2, 3 }").WithArguments("C.L1").WithLocation(3, 24), - // (3,42): error CS9507: Required member 'C.L2' must be assigned a value, it cannot use a nested member or collection initializer. + // (3,42): error CS9036: Required member 'C.L2' must be assigned a value, it cannot use a nested member or collection initializer. // var c = new C() { L1 = { 1, 2, 3 }, L2 = { 4, 5, 6 } }; Diagnostic(ErrorCode.ERR_RequiredMembersMustBeAssignedValue, "{ 4, 5, 6 }").WithArguments("C.L2").WithLocation(3, 42) ); @@ -1845,16 +1845,16 @@ public class Derived : Base var comp = CreateCompilationWithRequiredMembers(new[] { @base, code }); var expectedDiagnostics = new[] { - // (2,9): error CS9506: Required member 'Base.Prop1' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Base.Prop1' must be set in the object initializer or attribute constructor. // _ = new Derived(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Base.Prop1").WithLocation(2, 9), - // (2,9): error CS9506: Required member 'Base.Field1' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Base.Field1' must be set in the object initializer or attribute constructor. // _ = new Derived(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Base.Field1").WithLocation(2, 9), - // (2,9): error CS9506: Required member 'Derived.Prop2' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Derived.Prop2' must be set in the object initializer or attribute constructor. // _ = new Derived(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Derived.Prop2").WithLocation(2, 9), - // (2,9): error CS9506: Required member 'Derived.Field2' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Derived.Field2' must be set in the object initializer or attribute constructor. // _ = new Derived(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Derived.Field2").WithLocation(2, 9) }; @@ -1939,16 +1939,16 @@ public class Derived : Base var comp = CreateCompilationWithRequiredMembers(new[] { @base, code }); var expectedDiagnostics = new[] { - // (2,9): error CS9506: Required member 'Base.Prop2' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Base.Prop2' must be set in the object initializer or attribute constructor. // _ = new Derived() { Prop1 = 1, Field1 = 1, Prop3 = 3, Field3 = 3 }; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Base.Prop2").WithLocation(2, 9), - // (2,9): error CS9506: Required member 'Base.Field2' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Base.Field2' must be set in the object initializer or attribute constructor. // _ = new Derived() { Prop1 = 1, Field1 = 1, Prop3 = 3, Field3 = 3 }; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Base.Field2").WithLocation(2, 9), - // (2,9): error CS9506: Required member 'Derived.Prop4' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Derived.Prop4' must be set in the object initializer or attribute constructor. // _ = new Derived() { Prop1 = 1, Field1 = 1, Prop3 = 3, Field3 = 3 }; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Derived.Prop4").WithLocation(2, 9), - // (2,9): error CS9506: Required member 'Derived.Field4' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Derived.Field4' must be set in the object initializer or attribute constructor. // _ = new Derived() { Prop1 = 1, Field1 = 1, Prop3 = 3, Field3 = 3 }; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Derived.Field4").WithLocation(2, 9) }; @@ -2057,16 +2057,16 @@ public class Derived : Base var comp = CreateCompilation(code, new[] { baseComp.ToMetadataReference(), retargetedC.ToMetadataReference() }, targetFramework: TargetFramework.Standard); comp.VerifyDiagnostics( - // (2,9): error CS9506: Required member 'Base.Field1' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Base.Field1' must be set in the object initializer or attribute constructor. // _ = new Derived(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Base.Field1").WithLocation(2, 9), - // (2,9): error CS9506: Required member 'Base.Prop1' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Base.Prop1' must be set in the object initializer or attribute constructor. // _ = new Derived(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Base.Prop1").WithLocation(2, 9), - // (2,9): error CS9506: Required member 'Derived.Prop2' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Derived.Prop2' must be set in the object initializer or attribute constructor. // _ = new Derived(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Derived.Prop2").WithLocation(2, 9), - // (2,9): error CS9506: Required member 'Derived.Field2' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Derived.Field2' must be set in the object initializer or attribute constructor. // _ = new Derived(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Derived.Field2").WithLocation(2, 9) ); @@ -2180,7 +2180,7 @@ public class Derived : Base var comp = CreateCompilationWithRequiredMembers(new[] { @base, code }); var expectedDiagnostics = new[] { - // (2,9): error CS9506: Required member 'Derived.Prop1' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Derived.Prop1' must be set in the object initializer or attribute constructor. // _ = new Derived(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Derived.Prop1").WithLocation(2, 9) }; @@ -2254,7 +2254,7 @@ public class Derived : Base var comp = CreateCompilationWithRequiredMembers(new[] { @base, code }); var expectedDiagnostics = new[] { - // (2,9): error CS9506: Required member 'Derived.Prop1' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Derived.Prop1' must be set in the object initializer or attribute constructor. // _ = new Derived() { Prop2 = 1 }; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Derived.Prop1").WithLocation(2, 9) }; @@ -2358,7 +2358,7 @@ public class Derived : Base var comp = CreateCompilation(code, new[] { baseComp.ToMetadataReference(), retargetedC.ToMetadataReference() }); comp.VerifyDiagnostics( - // (2,9): error CS9506: Required member 'Derived.Prop1' must be set in the object initializer or attribute constructor. + // (2,9): error CS9035: Required member 'Derived.Prop1' must be set in the object initializer or attribute constructor. // _ = new Derived(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Derived").WithArguments("Derived.Prop1").WithLocation(2, 9) ); @@ -2401,13 +2401,13 @@ class Derived3 : Derived { }"; var comp = CreateCompilation(c, new[] { vbComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (7,12): error CS9509: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. + // (7,12): error CS9038: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. // public Derived2() {} Diagnostic(ErrorCode.ERR_RequiredMembersBaseTypeInvalid, "Derived2").WithArguments("Derived").WithLocation(7, 12), - // (8,12): error CS9509: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. + // (8,12): error CS9038: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. // public Derived2(int x) {} Diagnostic(ErrorCode.ERR_RequiredMembersBaseTypeInvalid, "Derived2").WithArguments("Derived").WithLocation(8, 12), - // (10,7): error CS9509: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. + // (10,7): error CS9038: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. // class Derived3 : Derived { } Diagnostic(ErrorCode.ERR_RequiredMembersBaseTypeInvalid, "Derived3").WithArguments("Derived").WithLocation(10, 7) ); @@ -2484,10 +2484,10 @@ class Derived3 : Derived { }"; var comp = CreateCompilation(c, new[] { vbComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (7,12): error CS9509: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. + // (7,12): error CS9038: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. // public Derived2() {} Diagnostic(ErrorCode.ERR_RequiredMembersBaseTypeInvalid, "Derived2").WithArguments("Derived").WithLocation(7, 12), - // (9,7): error CS9509: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. + // (9,7): error CS9038: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. // class Derived3 : Derived { } Diagnostic(ErrorCode.ERR_RequiredMembersBaseTypeInvalid, "Derived3").WithArguments("Derived").WithLocation(9, 7) ); @@ -2525,10 +2525,10 @@ class Derived3 : Derived { }"; var comp = CreateCompilation(c, new[] { vbComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (7,12): error CS9509: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. + // (7,12): error CS9038: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. // public Derived2() {} Diagnostic(ErrorCode.ERR_RequiredMembersBaseTypeInvalid, "Derived2").WithArguments("Derived").WithLocation(7, 12), - // (9,7): error CS9509: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. + // (9,7): error CS9038: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. // class Derived3 : Derived { } Diagnostic(ErrorCode.ERR_RequiredMembersBaseTypeInvalid, "Derived3").WithArguments("Derived").WithLocation(9, 7) ); @@ -2751,13 +2751,13 @@ record DerivedDerived3() : Derived; var comp = CreateCompilation(c, new[] { il, originalComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (8,12): error CS9509: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. + // (8,12): error CS9038: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. // public DerivedDerived1() Diagnostic(ErrorCode.ERR_RequiredMembersBaseTypeInvalid, "DerivedDerived1").WithArguments("Derived").WithLocation(8, 12), - // (12,8): error CS9509: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. + // (12,8): error CS9038: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. // record DerivedDerived2 : Derived Diagnostic(ErrorCode.ERR_RequiredMembersBaseTypeInvalid, "DerivedDerived2").WithArguments("Derived").WithLocation(12, 8), - // (15,8): error CS9509: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. + // (15,8): error CS9038: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. // record DerivedDerived3() : Derived; Diagnostic(ErrorCode.ERR_RequiredMembersBaseTypeInvalid, "DerivedDerived3").WithArguments("Derived").WithLocation(15, 8) ); @@ -2840,7 +2840,7 @@ public DerivedDerived1(bool unused) : base(null) var comp = CreateCompilation(c, new[] { il, originalComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (18,12): error CS9509: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. + // (18,12): error CS9038: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. // public DerivedDerived1(bool unused) : base(null) Diagnostic(ErrorCode.ERR_RequiredMembersBaseTypeInvalid, "DerivedDerived1").WithArguments("Derived").WithLocation(18, 12) ); @@ -2881,13 +2881,13 @@ record DerivedDerived3() : Derived; var comp = CreateCompilation(c, new[] { il, originalComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (8,12): error CS9509: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. + // (8,12): error CS9038: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. // public DerivedDerived1() Diagnostic(ErrorCode.ERR_RequiredMembersBaseTypeInvalid, "DerivedDerived1").WithArguments("Derived").WithLocation(8, 12), - // (12,8): error CS9509: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. + // (12,8): error CS9038: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. // record DerivedDerived2 : Derived Diagnostic(ErrorCode.ERR_RequiredMembersBaseTypeInvalid, "DerivedDerived2").WithArguments("Derived").WithLocation(12, 8), - // (15,8): error CS9509: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. + // (15,8): error CS9038: The required members list for the base type 'Derived' is malformed and cannot be interpreted. To use this constructor, apply the 'SetsRequiredMembers' attribute. // record DerivedDerived3() : Derived; Diagnostic(ErrorCode.ERR_RequiredMembersBaseTypeInvalid, "DerivedDerived3").WithArguments("Derived").WithLocation(15, 8) ); @@ -2963,7 +2963,7 @@ End Class """; var comp = CreateCompilation(c, new[] { vbComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (1,9): error CS9508: The required members list for 'Derived' is malformed and cannot be interpreted. + // (1,9): error CS9037: The required members list for 'Derived' is malformed and cannot be interpreted. // _ = new Derived(); Diagnostic(ErrorCode.ERR_RequiredMembersInvalid, "Derived").WithArguments("Derived").WithLocation(1, 9) ); @@ -3004,7 +3004,7 @@ End Class """; var comp = CreateCompilation(c, new[] { vbComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (1,9): error CS9508: The required members list for 'Derived' is malformed and cannot be interpreted. + // (1,9): error CS9037: The required members list for 'Derived' is malformed and cannot be interpreted. // _ = new Derived(); Diagnostic(ErrorCode.ERR_RequiredMembersInvalid, "Derived").WithArguments("Derived").WithLocation(1, 9) ); @@ -3044,7 +3044,7 @@ End Class """; var comp = CreateCompilation(c, new[] { vbComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (1,9): error CS9508: The required members list for 'Derived' is malformed and cannot be interpreted. + // (1,9): error CS9037: The required members list for 'Derived' is malformed and cannot be interpreted. // _ = new Derived(); Diagnostic(ErrorCode.ERR_RequiredMembersInvalid, "Derived").WithArguments("Derived").WithLocation(1, 9) ); @@ -3065,7 +3065,7 @@ partial class CustomHandler var comp = CreateCompilationWithRequiredMembers(new[] { code, handler }); comp.VerifyDiagnostics( - // (2,25): error CS9506: Required member 'CustomHandler.Field' must be set in the object initializer or attribute constructor. + // (2,25): error CS9035: Required member 'CustomHandler.Field' must be set in the object initializer or attribute constructor. // CustomHandler handler = $""; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, @"$""""").WithArguments("CustomHandler.Field").WithLocation(2, 25) ); @@ -3094,7 +3094,7 @@ class C : I "; var comp = CreateCompilationWithRequiredMembers(code); comp.VerifyDiagnostics( - // (5,9): error CS9506: Required member 'C.P' must be set in the object initializer or attribute constructor. + // (5,9): error CS9035: Required member 'C.P' must be set in the object initializer or attribute constructor. // _ = new I(); Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "I").WithArguments("C.P").WithLocation(5, 9) ); @@ -3123,7 +3123,7 @@ class C : I "; var comp = CreateCompilationWithRequiredMembers(code); comp.VerifyDiagnostics( - // (5,9): error CS9506: Required member 'C.P' must be set in the object initializer or attribute constructor. + // (5,9): error CS9035: Required member 'C.P' must be set in the object initializer or attribute constructor. // _ = new I() { P = 1 }; Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "I").WithArguments("C.P").WithLocation(5, 9) ); @@ -3148,7 +3148,7 @@ class AttrAttribute : Attribute var comp = CreateCompilationWithRequiredMembers(code); comp.VerifyDiagnostics( - // (4,2): error CS9506: Required member 'AttrAttribute.P' must be set in the object initializer or attribute constructor. + // (4,2): error CS9035: Required member 'AttrAttribute.P' must be set in the object initializer or attribute constructor. // [Attr] Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "Attr").WithArguments("AttrAttribute.P").WithLocation(4, 2) ); @@ -3291,10 +3291,10 @@ public class RequiredMemberAttribute : Attribute var comp = CreateCompilation(new[] { code, CompilerFeatureRequiredAttribute }); comp.VerifyDiagnostics( - // (4,2): error CS9506: Required member 'RequiredMemberAttribute.P' must be set in the object initializer or attribute constructor. + // (4,2): error CS9035: Required member 'RequiredMemberAttribute.P' must be set in the object initializer or attribute constructor. // [RequiredMember] Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "RequiredMember").WithArguments("System.Runtime.CompilerServices.RequiredMemberAttribute.P").WithLocation(4, 2), - // (4,2): error CS9504: Do not use 'System.Runtime.CompilerServices.RequiredMemberAttribute'. Use the 'required' keyword on required fields and properties instead. + // (4,2): error CS9033: Do not use 'System.Runtime.CompilerServices.RequiredMemberAttribute'. Use the 'required' keyword on required fields and properties instead. // [RequiredMember] Diagnostic(ErrorCode.ERR_ExplicitRequiredMember, "RequiredMember").WithLocation(4, 2) ); @@ -3315,10 +3315,10 @@ public class RequiredMemberAttribute : Attribute var comp = CreateCompilation(new[] { code, CompilerFeatureRequiredAttribute }); comp.VerifyDiagnostics( - // (6,6): error CS9506: Required member 'RequiredMemberAttribute.P' must be set in the object initializer or attribute constructor. + // (6,6): error CS9035: Required member 'RequiredMemberAttribute.P' must be set in the object initializer or attribute constructor. // [RequiredMember] Diagnostic(ErrorCode.ERR_RequiredMemberMustBeSet, "RequiredMember").WithArguments("System.Runtime.CompilerServices.RequiredMemberAttribute.P").WithLocation(6, 6), - // (6,6): error CS9504: Do not use 'System.Runtime.CompilerServices.RequiredMemberAttribute'. Use the 'required' keyword on required fields and properties instead. + // (6,6): error CS9033: Do not use 'System.Runtime.CompilerServices.RequiredMemberAttribute'. Use the 'required' keyword on required fields and properties instead. // [RequiredMember] Diagnostic(ErrorCode.ERR_ExplicitRequiredMember, "RequiredMember").WithLocation(6, 6) ); @@ -3814,7 +3814,7 @@ public Derived() : base() // 2 // (9,15): warning CS8618: Non-nullable property 'Prop1' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. // protected Base() {} // 1 Diagnostic(ErrorCode.WRN_UninitializedNonNullableField, "Base").WithArguments("property", "Prop1").WithLocation(9, 15), - // (17,24): error CS9510: This constructor must add 'SetsRequiredMembers' because it chains to a constructor that has that attribute. + // (17,24): error CS9039: This constructor must add 'SetsRequiredMembers' because it chains to a constructor that has that attribute. // public Derived() : base() // 2 Diagnostic(ErrorCode.ERR_ChainingToSetsRequiredMembersRequiresSetsRequiredMembers, "base").WithLocation(17, 24), // (21,9): warning CS8602: Dereference of a possibly null reference. @@ -3866,7 +3866,7 @@ public Derived() : this(0) // (17,12): warning CS8618: Non-nullable property 'Prop3' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. // public Derived(int unused) : base() Diagnostic(ErrorCode.WRN_UninitializedNonNullableField, "Derived").WithArguments("property", "Prop3").WithLocation(17, 12), - // (22,24): error CS9510: This constructor must add 'SetsRequiredMembers' because it chains to a constructor that has that attribute. + // (22,24): error CS9039: This constructor must add 'SetsRequiredMembers' because it chains to a constructor that has that attribute. // public Derived() : this(0) Diagnostic(ErrorCode.ERR_ChainingToSetsRequiredMembersRequiresSetsRequiredMembers, "this").WithLocation(22, 24) ); @@ -4170,7 +4170,7 @@ public record Derived(bool unused) : Base(unused); var comp = CreateCompilationWithIL(code, ilSource: il, references: new[] { attrComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (2,42): error CS9510: This constructor must add 'SetsRequiredMembers' because it chains to a constructor that has that attribute. + // (2,42): error CS9039: This constructor must add 'SetsRequiredMembers' because it chains to a constructor that has that attribute. // public record Derived(bool unused) : Base(unused); Diagnostic(ErrorCode.ERR_ChainingToSetsRequiredMembersRequiresSetsRequiredMembers, "(unused)").WithLocation(2, 42) ); @@ -4318,7 +4318,7 @@ public void ForbidRequiredAsNew_NoInheritance(string typeKind) var comp = CreateCompilationWithRequiredMembers(code); comp.VerifyDiagnostics( - // (1,1): error CS9511: 'C' cannot satisfy the 'new()' constraint on parameter 'T' in the generic type or or method 'M()' because 'C' has required members. + // (1,1): error CS9040: 'C' cannot satisfy the 'new()' constraint on parameter 'T' in the generic type or or method 'M()' because 'C' has required members. // M(); Diagnostic(ErrorCode.ERR_NewConstraintCannotHaveRequiredMembers, "M").WithArguments("M()", "T", "C").WithLocation(1, 1) ); @@ -4349,7 +4349,7 @@ class Derived : Base var comp = CreateCompilationWithRequiredMembers(new[] { @base, code }); comp.VerifyDiagnostics( - // (1,1): error CS9511: 'Derived' cannot satisfy the 'new()' constraint on parameter 'T' in the generic type or or method 'M()' because 'Derived' has required members. + // (1,1): error CS9040: 'Derived' cannot satisfy the 'new()' constraint on parameter 'T' in the generic type or or method 'M()' because 'Derived' has required members. // M(); Diagnostic(ErrorCode.ERR_NewConstraintCannotHaveRequiredMembers, "M").WithArguments("M()", "T", "Derived").WithLocation(1, 1) ); @@ -4359,7 +4359,7 @@ class Derived : Base comp = CreateCompilation(code, references: new[] { useMetadataReference ? baseComp.ToMetadataReference() : baseComp.EmitToImageReference() }); comp.VerifyDiagnostics( - // (1,1): error CS9511: 'Derived' cannot satisfy the 'new()' constraint on parameter 'T' in the generic type or or method 'M()' because 'Derived' has required members. + // (1,1): error CS9040: 'Derived' cannot satisfy the 'new()' constraint on parameter 'T' in the generic type or or method 'M()' because 'Derived' has required members. // M(); Diagnostic(ErrorCode.ERR_NewConstraintCannotHaveRequiredMembers, "M").WithArguments("M()", "T", "Derived").WithLocation(1, 1) ); diff --git a/src/Compilers/CSharp/Test/Syntax/Parsing/MemberDeclarationParsingTests.cs b/src/Compilers/CSharp/Test/Syntax/Parsing/MemberDeclarationParsingTests.cs index 43ab6ce076854..f4abc24588a95 100644 --- a/src/Compilers/CSharp/Test/Syntax/Parsing/MemberDeclarationParsingTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Parsing/MemberDeclarationParsingTests.cs @@ -1331,6 +1331,55 @@ public void RequiredModifierProperty_05() EOF(); } + [Fact, CompilerTrait(CompilerFeature.RequiredMembers)] + public void RequiredModifierProperty_06() + { + UsingDeclaration("required required Prop { get; }", options: RequiredMembersOptions, + // (1,1): error CS1073: Unexpected token '{' + // required required Prop { get; } + Diagnostic(ErrorCode.ERR_UnexpectedToken, "required required Prop").WithArguments("{").WithLocation(1, 1), + // (1,24): error CS1519: Invalid token '{' in class, record, struct, or interface member declaration + // required required Prop { get; } + Diagnostic(ErrorCode.ERR_InvalidMemberDecl, "{").WithArguments("{").WithLocation(1, 24) + ); + N(SyntaxKind.IncompleteMember); + { + N(SyntaxKind.RequiredKeyword); + N(SyntaxKind.RequiredKeyword); + N(SyntaxKind.IdentifierName); + { + N(SyntaxKind.IdentifierToken, "Prop"); + } + } + EOF(); + } + + [Fact, CompilerTrait(CompilerFeature.RequiredMembers)] + public void RequiredModifierProperty_07() + { + UsingDeclaration("required Type required { get; }", options: RequiredMembersOptions); + N(SyntaxKind.PropertyDeclaration); + { + N(SyntaxKind.RequiredKeyword); + N(SyntaxKind.IdentifierName); + { + N(SyntaxKind.IdentifierToken, "Type"); + } + N(SyntaxKind.IdentifierToken, "required"); + N(SyntaxKind.AccessorList); + { + N(SyntaxKind.OpenBraceToken); + N(SyntaxKind.GetAccessorDeclaration); + { + N(SyntaxKind.GetKeyword); + N(SyntaxKind.SemicolonToken); + } + N(SyntaxKind.CloseBraceToken); + } + } + EOF(); + } + [Theory, CompilerTrait(CompilerFeature.RequiredMembers)] [MemberData(nameof(Regular10AndScriptAndRequiredMembersMinimum))] public void RequiredModifierField_01(CSharpParseOptions parseOptions) @@ -1813,6 +1862,66 @@ public void RequiredModifierIncompleteMember_05() EOF(); } + [Theory, CompilerTrait(CompilerFeature.RequiredMembers), WorkItem(61510, "https://github.com/dotnet/roslyn/issues/61510")] + [MemberData(nameof(Regular10AndScriptAndRequiredMembersMinimum))] + public void RequiredModifier_LocalNamedRequired_TopLevelStatements(CSharpParseOptions parseOptions) + { + bool isScript = parseOptions.Kind == SourceCodeKind.Script; + + UsingTree(""" + bool required; + required = true; + """, options: parseOptions); + N(SyntaxKind.CompilationUnit); + { + if (isScript) + { + N(SyntaxKind.FieldDeclaration); + } + else + { + N(SyntaxKind.GlobalStatement); + N(SyntaxKind.LocalDeclarationStatement); + } + + { + N(SyntaxKind.VariableDeclaration); + { + N(SyntaxKind.PredefinedType); + { + N(SyntaxKind.BoolKeyword); + } + N(SyntaxKind.VariableDeclarator); + { + N(SyntaxKind.IdentifierToken, "required"); + } + } + N(SyntaxKind.SemicolonToken); + } + N(SyntaxKind.GlobalStatement); + { + N(SyntaxKind.ExpressionStatement); + { + N(SyntaxKind.SimpleAssignmentExpression); + { + N(SyntaxKind.IdentifierName); + { + N(SyntaxKind.IdentifierToken, "required"); + } + N(SyntaxKind.EqualsToken); + N(SyntaxKind.TrueLiteralExpression); + { + N(SyntaxKind.TrueKeyword); + } + } + N(SyntaxKind.SemicolonToken); + } + } + N(SyntaxKind.EndOfFileToken); + } + EOF(); + } + [Fact] public void OperatorDeclaration_ExplicitImplementation_01() {