diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart index 04f56097773..9c7bfac5c74 100644 --- a/pkg/analyzer/lib/error/error.dart +++ b/pkg/analyzer/lib/error/error.dart @@ -585,10 +585,7 @@ const List errorCodeValues = [ ParserErrorCode.CLASS_IN_CLASS, ParserErrorCode.COLON_IN_PLACE_OF_IN, ParserErrorCode.CONFLICTING_MODIFIERS, - ParserErrorCode.CONST_AFTER_FACTORY, - ParserErrorCode.CONST_AND_COVARIANT, ParserErrorCode.CONST_AND_FINAL, - ParserErrorCode.CONST_AND_VAR, ParserErrorCode.CONST_CLASS, ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, ParserErrorCode.CONST_ENUM, @@ -598,8 +595,6 @@ const List errorCodeValues = [ ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP, ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE, - ParserErrorCode.COVARIANT_AFTER_FINAL, - ParserErrorCode.COVARIANT_AFTER_VAR, ParserErrorCode.COVARIANT_AND_STATIC, ParserErrorCode.COVARIANT_CONSTRUCTOR, ParserErrorCode.COVARIANT_MEMBER, @@ -629,9 +624,6 @@ const List errorCodeValues = [ ParserErrorCode.EXTENSION_DECLARES_ABSTRACT_MEMBER, ParserErrorCode.EXTENSION_DECLARES_CONSTRUCTOR, ParserErrorCode.EXTENSION_DECLARES_INSTANCE_FIELD, - ParserErrorCode.EXTERNAL_AFTER_CONST, - ParserErrorCode.EXTERNAL_AFTER_FACTORY, - ParserErrorCode.EXTERNAL_AFTER_STATIC, ParserErrorCode.EXTERNAL_CLASS, ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY, ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_INITIALIZER, @@ -691,7 +683,6 @@ const List errorCodeValues = [ ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER, ParserErrorCode.MISSING_CATCH_OR_FINALLY, - ParserErrorCode.MISSING_CLASS_BODY, ParserErrorCode.MISSING_CLOSING_PARENTHESIS, ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, ParserErrorCode.MISSING_ENUM_BODY, @@ -748,9 +739,6 @@ const List errorCodeValues = [ ParserErrorCode.SETTER_CONSTRUCTOR, ParserErrorCode.SETTER_IN_FUNCTION, ParserErrorCode.STACK_OVERFLOW, - ParserErrorCode.STATIC_AFTER_CONST, - ParserErrorCode.STATIC_AFTER_FINAL, - ParserErrorCode.STATIC_AFTER_VAR, ParserErrorCode.STATIC_CONSTRUCTOR, ParserErrorCode.STATIC_GETTER_WITHOUT_BODY, ParserErrorCode.STATIC_OPERATOR, @@ -821,7 +809,14 @@ ErrorCode errorCodeByUniqueName(String uniqueName) { if (_uniqueNameToCodeMap == null) { _uniqueNameToCodeMap = HashMap(); for (ErrorCode errorCode in errorCodeValues) { - _uniqueNameToCodeMap[errorCode.uniqueName] = errorCode; + var uniqueName = errorCode.uniqueName; + assert(() { + if (_uniqueNameToCodeMap.containsKey(uniqueName)) { + throw StateError('Not unique: $uniqueName'); + } + return true; + }()); + _uniqueNameToCodeMap[uniqueName] = errorCode; } } return _uniqueNameToCodeMap[uniqueName]; diff --git a/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart b/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart index d2b2e0e9273..57cc39489c3 100644 --- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart +++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart @@ -79,17 +79,8 @@ class ParserErrorCode extends ErrorCode { static const ParserErrorCode CONFLICTING_MODIFIERS = _CONFLICTING_MODIFIERS; - // TODO(danrubel): Remove this unused error code - static const ParserErrorCode CONST_AFTER_FACTORY = _MODIFIER_OUT_OF_ORDER; - - // TODO(danrubel): Remove this unused error code - static const ParserErrorCode CONST_AND_COVARIANT = _CONFLICTING_MODIFIERS; - static const ParserErrorCode CONST_AND_FINAL = _CONST_AND_FINAL; - // TODO(danrubel): Remove this unused error code - static const ParserErrorCode CONST_AND_VAR = _CONFLICTING_MODIFIERS; - static const ParserErrorCode CONST_CLASS = _CONST_CLASS; static const ParserErrorCode CONST_CONSTRUCTOR_WITH_BODY = ParserErrorCode( @@ -117,11 +108,6 @@ class ParserErrorCode extends ErrorCode { static const ParserErrorCode CONTINUE_WITHOUT_LABEL_IN_CASE = _CONTINUE_WITHOUT_LABEL_IN_CASE; - // TODO(danrubel): Remove this unused error code - static const ParserErrorCode COVARIANT_AFTER_FINAL = _MODIFIER_OUT_OF_ORDER; - - static const ParserErrorCode COVARIANT_AFTER_VAR = _MODIFIER_OUT_OF_ORDER; - static const ParserErrorCode COVARIANT_AND_STATIC = _COVARIANT_AND_STATIC; static const ParserErrorCode COVARIANT_CONSTRUCTOR = ParserErrorCode( @@ -294,12 +280,6 @@ class ParserErrorCode extends ErrorCode { static const ParserErrorCode EXTENSION_DECLARES_INSTANCE_FIELD = _EXTENSION_DECLARES_INSTANCE_FIELD; - static const ParserErrorCode EXTERNAL_AFTER_CONST = _MODIFIER_OUT_OF_ORDER; - - static const ParserErrorCode EXTERNAL_AFTER_FACTORY = _MODIFIER_OUT_OF_ORDER; - - static const ParserErrorCode EXTERNAL_AFTER_STATIC = _MODIFIER_OUT_OF_ORDER; - static const ParserErrorCode EXTERNAL_CLASS = _EXTERNAL_CLASS; static const ParserErrorCode EXTERNAL_CONSTRUCTOR_WITH_BODY = @@ -544,8 +524,6 @@ class ParserErrorCode extends ErrorCode { static const ParserErrorCode MISSING_CATCH_OR_FINALLY = _MISSING_CATCH_OR_FINALLY; - static const ParserErrorCode MISSING_CLASS_BODY = _EXPECTED_BODY; - static const ParserErrorCode MISSING_CLOSING_PARENTHESIS = ParserErrorCode( 'MISSING_CLOSING_PARENTHESIS', "The closing parenthesis is missing.", correction: "Try adding the closing parenthesis."); @@ -794,12 +772,6 @@ class ParserErrorCode extends ErrorCode { static const ParserErrorCode STACK_OVERFLOW = _STACK_OVERFLOW; - static const ParserErrorCode STATIC_AFTER_CONST = _MODIFIER_OUT_OF_ORDER; - - static const ParserErrorCode STATIC_AFTER_FINAL = _MODIFIER_OUT_OF_ORDER; - - static const ParserErrorCode STATIC_AFTER_VAR = _MODIFIER_OUT_OF_ORDER; - static const ParserErrorCode STATIC_CONSTRUCTOR = _STATIC_CONSTRUCTOR; static const ParserErrorCode STATIC_GETTER_WITHOUT_BODY = ParserErrorCode( diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart index d23a065bb3a..84704c33a89 100644 --- a/pkg/analyzer/lib/src/generated/parser.dart +++ b/pkg/analyzer/lib/src/generated/parser.dart @@ -1160,7 +1160,7 @@ class Parser { // members until it is reached. leftBracket = _createSyntheticToken(TokenType.OPEN_CURLY_BRACKET); rightBracket = _createSyntheticToken(TokenType.CLOSE_CURLY_BRACKET); - _reportErrorForCurrentToken(ParserErrorCode.MISSING_CLASS_BODY); + _reportErrorForCurrentToken(ParserErrorCode.EXPECTED_BODY); } ClassDeclaration classDeclaration = astFactory.classDeclaration( commentAndMetadata.comment, @@ -7729,13 +7729,13 @@ class Parser { constKeyword != null && constKeyword.offset < externalKeyword.offset) { _reportErrorForToken( - ParserErrorCode.EXTERNAL_AFTER_CONST, externalKeyword); + ParserErrorCode.MODIFIER_OUT_OF_ORDER, externalKeyword); } if (externalKeyword != null && factoryKeyword != null && factoryKeyword.offset < externalKeyword.offset) { _reportErrorForToken( - ParserErrorCode.EXTERNAL_AFTER_FACTORY, externalKeyword); + ParserErrorCode.MODIFIER_OUT_OF_ORDER, externalKeyword); } return constKeyword; } @@ -7785,16 +7785,17 @@ class Parser { if (constKeyword != null) { if (covariantKeyword != null) { _reportErrorForToken( - ParserErrorCode.CONST_AND_COVARIANT, covariantKeyword); + ParserErrorCode.MODIFIER_OUT_OF_ORDER, covariantKeyword); } if (finalKeyword != null) { _reportErrorForToken(ParserErrorCode.CONST_AND_FINAL, finalKeyword); } if (varKeyword != null) { - _reportErrorForToken(ParserErrorCode.CONST_AND_VAR, varKeyword); + _reportErrorForToken(ParserErrorCode.MODIFIER_OUT_OF_ORDER, varKeyword); } if (staticKeyword != null && constKeyword.offset < staticKeyword.offset) { - _reportErrorForToken(ParserErrorCode.STATIC_AFTER_CONST, staticKeyword); + _reportErrorForToken( + ParserErrorCode.MODIFIER_OUT_OF_ORDER, staticKeyword); } } else if (finalKeyword != null) { if (covariantKeyword != null) { @@ -7805,16 +7806,18 @@ class Parser { _reportErrorForToken(ParserErrorCode.FINAL_AND_VAR, varKeyword); } if (staticKeyword != null && finalKeyword.offset < staticKeyword.offset) { - _reportErrorForToken(ParserErrorCode.STATIC_AFTER_FINAL, staticKeyword); + _reportErrorForToken( + ParserErrorCode.MODIFIER_OUT_OF_ORDER, staticKeyword); } } else if (varKeyword != null) { if (staticKeyword != null && varKeyword.offset < staticKeyword.offset) { - _reportErrorForToken(ParserErrorCode.STATIC_AFTER_VAR, staticKeyword); + _reportErrorForToken( + ParserErrorCode.MODIFIER_OUT_OF_ORDER, staticKeyword); } if (covariantKeyword != null && varKeyword.offset < covariantKeyword.offset) { _reportErrorForToken( - ParserErrorCode.COVARIANT_AFTER_VAR, covariantKeyword); + ParserErrorCode.MODIFIER_OUT_OF_ORDER, covariantKeyword); } } if (covariantKeyword != null && staticKeyword != null) { @@ -7870,7 +7873,7 @@ class Parser { staticKeyword != null && staticKeyword.offset < externalKeyword.offset) { _reportErrorForToken( - ParserErrorCode.EXTERNAL_AFTER_STATIC, externalKeyword); + ParserErrorCode.MODIFIER_OUT_OF_ORDER, externalKeyword); } } @@ -7957,7 +7960,7 @@ class Parser { _reportErrorForToken(ParserErrorCode.CONST_AND_FINAL, finalKeyword); } if (varKeyword != null) { - _reportErrorForToken(ParserErrorCode.CONST_AND_VAR, varKeyword); + _reportErrorForToken(ParserErrorCode.MODIFIER_OUT_OF_ORDER, varKeyword); } } else if (finalKeyword != null) { if (varKeyword != null) { diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart index c39d80fda54..ff14226ee36 100644 --- a/pkg/analyzer/test/generated/parser_fasta_test.dart +++ b/pkg/analyzer/test/generated/parser_fasta_test.dart @@ -1814,7 +1814,7 @@ class C {} var unit = parseCompilationUnit('extension E', errors: [ expectedError(ParserErrorCode.EXPECTED_TOKEN, 10, 1), expectedError(ParserErrorCode.EXPECTED_TYPE_NAME, 11, 0), - expectedError(ParserErrorCode.MISSING_CLASS_BODY, 11, 0), + expectedError(ParserErrorCode.EXPECTED_BODY, 11, 0), ]); expect(unit.declarations, hasLength(1)); var extension = unit.declarations[0] as ExtensionDeclaration; diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart index b1fcee97052..054d6f131a0 100644 --- a/pkg/analyzer/test/generated/parser_test.dart +++ b/pkg/analyzer/test/generated/parser_test.dart @@ -2499,7 +2499,7 @@ mixin ErrorParserTestMixin implements AbstractParserTestCase { ClassMember member = parser.parseClassMember('C'); expectNotNullIfNoErrors(member); listener.assertErrors( - [expectedError(ParserErrorCode.CONST_AND_COVARIANT, 10, 5)]); + [expectedError(ParserErrorCode.CONFLICTING_MODIFIERS, 10, 5)]); } void test_constAndFinal() { @@ -2514,7 +2514,8 @@ mixin ErrorParserTestMixin implements AbstractParserTestCase { createParser('const var x = null;'); ClassMember member = parser.parseClassMember('C'); expectNotNullIfNoErrors(member); - listener.assertErrors([expectedError(ParserErrorCode.CONST_AND_VAR, 6, 3)]); + listener.assertErrors( + [expectedError(ParserErrorCode.CONFLICTING_MODIFIERS, 6, 3)]); } void test_constClass() { @@ -2724,7 +2725,7 @@ mixin ErrorParserTestMixin implements AbstractParserTestCase { ClassMember member = parser.parseClassMember('C'); expectNotNullIfNoErrors(member); listener.assertErrors( - [expectedError(ParserErrorCode.COVARIANT_AFTER_VAR, 4, 9)]); + [expectedError(ParserErrorCode.MODIFIER_OUT_OF_ORDER, 4, 9)]); } void test_covariantAndFinal() { @@ -2964,6 +2965,11 @@ class Foo { ]); } + void test_expectedBody_class() { + parseCompilationUnit("class A class B {}", + errors: [expectedError(ParserErrorCode.EXPECTED_BODY, 6, 1)]); + } + void test_expectedCaseOrDefault() { SwitchStatement statement = parseStatement('switch (e) {break;}'); expectNotNullIfNoErrors(statement); @@ -3269,7 +3275,7 @@ class Foo { ClassMember member = parser.parseClassMember('C'); expectNotNullIfNoErrors(member); listener.assertErrors( - [expectedError(ParserErrorCode.EXTERNAL_AFTER_CONST, 6, 8)]); + [expectedError(ParserErrorCode.MODIFIER_OUT_OF_ORDER, 6, 8)]); } void test_externalAfterFactory() { @@ -3285,7 +3291,7 @@ class Foo { ClassMember member = parser.parseClassMember('C'); expectNotNullIfNoErrors(member); listener.assertErrors( - [expectedError(ParserErrorCode.EXTERNAL_AFTER_STATIC, 7, 8)]); + [expectedError(ParserErrorCode.MODIFIER_OUT_OF_ORDER, 7, 8)]); } void test_externalClass() { @@ -3537,7 +3543,7 @@ class Foo { expectNotNullIfNoErrors(member); listener.assertErrors(usingFastaParser ? [ - expectedError(ParserErrorCode.COVARIANT_AFTER_FINAL, 6, 9), + expectedError(ParserErrorCode.MODIFIER_OUT_OF_ORDER, 6, 9), expectedError(ParserErrorCode.FINAL_AND_COVARIANT, 6, 9) ] : [expectedError(ParserErrorCode.FINAL_AND_COVARIANT, 6, 9)]); @@ -4435,11 +4441,6 @@ class Wrong { expect(statement, isNotNull); } - void test_missingClassBody() { - parseCompilationUnit("class A class B {}", - errors: [expectedError(ParserErrorCode.MISSING_CLASS_BODY, 6, 1)]); - } - void test_missingClosingParenthesis() { createParser('(int a, int b ;', expectedEndOffset: 14 /* parsing ends at synthetic ')' */); @@ -5158,7 +5159,7 @@ class Wrong { ClassMember member = parser.parseClassMember('C'); expectNotNullIfNoErrors(member); listener.assertErrors( - [expectedError(ParserErrorCode.STATIC_AFTER_FINAL, 6, 6)]); + [expectedError(ParserErrorCode.MODIFIER_OUT_OF_ORDER, 6, 6)]); } void test_staticAfterFinal() { @@ -5167,11 +5168,11 @@ class Wrong { expectNotNullIfNoErrors(member); if (usingFastaParser) { listener.assertErrors([ - expectedError(ParserErrorCode.STATIC_AFTER_CONST, 6, 6), + expectedError(ParserErrorCode.MODIFIER_OUT_OF_ORDER, 6, 6), expectedError(CompileTimeErrorCode.CONST_NOT_INITIALIZED, 17, 1) ]); } else { - listener.assertErrorsWithCodes([ParserErrorCode.STATIC_AFTER_CONST]); + listener.assertErrorsWithCodes([ParserErrorCode.MODIFIER_OUT_OF_ORDER]); } } @@ -5179,8 +5180,8 @@ class Wrong { createParser('var static f;'); ClassMember member = parser.parseClassMember('C'); expectNotNullIfNoErrors(member); - listener - .assertErrors([expectedError(ParserErrorCode.STATIC_AFTER_VAR, 4, 6)]); + listener.assertErrors( + [expectedError(ParserErrorCode.MODIFIER_OUT_OF_ORDER, 4, 6)]); } void test_staticConstructor() { @@ -16275,7 +16276,7 @@ mixin TopLevelParserTestMixin implements AbstractParserTestCase { : [ expectedError(ParserErrorCode.EXPECTED_TYPE_NAME, 18, 4), expectedError(ParserErrorCode.EXPECTED_TOKEN, 18, 4), - expectedError(ParserErrorCode.MISSING_CLASS_BODY, 18, 4), + expectedError(ParserErrorCode.EXPECTED_BODY, 18, 4), expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 22, 1), expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 22, 1), expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 22, 1), diff --git a/pkg/analyzer/test/src/fasta/recovery/code_order_test.dart b/pkg/analyzer/test/src/fasta/recovery/code_order_test.dart index 78a24521c50..590f27ee2dc 100644 --- a/pkg/analyzer/test/src/fasta/recovery/code_order_test.dart +++ b/pkg/analyzer/test/src/fasta/recovery/code_order_test.dart @@ -89,7 +89,7 @@ class UnrelatedClass extends Bar {} testRecovery(''' class Foo extends CurrentlyTypingHere class UnrelatedClass extends Bar {} -''', [ParserErrorCode.MISSING_CLASS_BODY], ''' +''', [ParserErrorCode.EXPECTED_BODY], ''' class Foo extends CurrentlyTypingHere {} class UnrelatedClass extends Bar {} '''); @@ -362,7 +362,7 @@ mixin UnrelatedMixin on Bar {} testRecovery(''' mixin Foo implements CurrentlyTypingHere mixin UnrelatedMixin on Bar {} -''', [ParserErrorCode.MISSING_CLASS_BODY], ''' +''', [ParserErrorCode.EXPECTED_BODY], ''' mixin Foo implements CurrentlyTypingHere {} mixin UnrelatedMixin on Bar {} '''); diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/class_declaration_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/class_declaration_test.dart index 27774c83dd1..976c1915262 100644 --- a/pkg/analyzer/test/src/fasta/recovery/partial_code/class_declaration_test.dart +++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/class_declaration_test.dart @@ -20,19 +20,19 @@ class ClassDeclarationTest extends PartialCodeTest { 'class', [ ParserErrorCode.MISSING_IDENTIFIER, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'class _s_ {}', failing: ['functionNonVoid', 'getter']), - TestDescriptor('named', 'class A', - [ParserErrorCode.MISSING_CLASS_BODY], 'class A {}'), + TestDescriptor('named', 'class A', [ParserErrorCode.EXPECTED_BODY], + 'class A {}'), TestDescriptor( 'extend', 'class A extend', [ ParserErrorCode.EXPECTED_INSTEAD, ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'class A extend _s_ {}', expectedErrorsInValidCode: [ParserErrorCode.EXPECTED_INSTEAD], @@ -42,7 +42,7 @@ class ClassDeclarationTest extends PartialCodeTest { 'class A extends', [ ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'class A extends _s_ {}', failing: ['functionVoid', 'functionNonVoid', 'getter', 'mixin']), @@ -52,7 +52,7 @@ class ClassDeclarationTest extends PartialCodeTest { [ ParserErrorCode.EXPECTED_INSTEAD, ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'class A on _s_ {}', expectedErrorsInValidCode: [ParserErrorCode.EXPECTED_INSTEAD], @@ -75,7 +75,7 @@ class ClassDeclarationTest extends PartialCodeTest { 'class A extends B with', [ ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'class A extends B with _s_ {}', failing: ['functionVoid', 'functionNonVoid', 'getter', 'mixin']), @@ -89,7 +89,7 @@ class ClassDeclarationTest extends PartialCodeTest { 'class A extends B implements', [ ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'class A extends B implements _s_ {}', failing: ['functionVoid', 'functionNonVoid', 'getter', 'mixin']), @@ -103,7 +103,7 @@ class ClassDeclarationTest extends PartialCodeTest { 'class A extends B with C implements', [ ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'class A extends B with C implements _s_ {}', failing: ['functionVoid', 'functionNonVoid', 'getter', 'mixin']), @@ -117,7 +117,7 @@ class ClassDeclarationTest extends PartialCodeTest { 'class A implements', [ ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'class A implements _s_ {}', failing: ['functionVoid', 'functionNonVoid', 'getter', 'mixin']), @@ -131,7 +131,7 @@ class ClassDeclarationTest extends PartialCodeTest { 'class A implements B,', [ ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'class A implements B, _s_ {}', failing: ['functionVoid', 'functionNonVoid', 'getter', 'mixin']), diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/mixin_declaration_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/mixin_declaration_test.dart index 9d39e825317..6a81c41326a 100644 --- a/pkg/analyzer/test/src/fasta/recovery/partial_code/mixin_declaration_test.dart +++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/mixin_declaration_test.dart @@ -20,18 +20,18 @@ class MixinDeclarationTest extends PartialCodeTest { 'mixin', [ ParserErrorCode.MISSING_IDENTIFIER, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'mixin _s_ {}', failing: ['functionNonVoid', 'getter']), - TestDescriptor('named', 'mixin A', - [ParserErrorCode.MISSING_CLASS_BODY], 'mixin A {}'), + TestDescriptor('named', 'mixin A', [ParserErrorCode.EXPECTED_BODY], + 'mixin A {}'), TestDescriptor( 'on', 'mixin A on', [ ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'mixin A on _s_ {}', failing: ['functionVoid', 'functionNonVoid', 'getter', 'mixin']), @@ -41,7 +41,7 @@ class MixinDeclarationTest extends PartialCodeTest { [ ParserErrorCode.EXPECTED_INSTEAD, ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'mixin A extend _s_ {}', expectedErrorsInValidCode: [ParserErrorCode.EXPECTED_INSTEAD], @@ -52,7 +52,7 @@ class MixinDeclarationTest extends PartialCodeTest { [ ParserErrorCode.EXPECTED_INSTEAD, ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'mixin A extends _s_ {}', expectedErrorsInValidCode: [ParserErrorCode.EXPECTED_INSTEAD], @@ -64,7 +64,7 @@ class MixinDeclarationTest extends PartialCodeTest { 'mixin A on B,', [ ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'mixin A on B, _s_ {}', failing: ['functionVoid', 'functionNonVoid', 'getter', 'mixin']), @@ -81,7 +81,7 @@ class MixinDeclarationTest extends PartialCodeTest { 'mixin A on B implements', [ ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'mixin A on B implements _s_ {}', failing: ['functionVoid', 'functionNonVoid', 'getter', 'mixin']), @@ -95,7 +95,7 @@ class MixinDeclarationTest extends PartialCodeTest { 'mixin A implements', [ ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'mixin A implements _s_ {}', failing: ['functionVoid', 'functionNonVoid', 'getter', 'mixin']), @@ -109,7 +109,7 @@ class MixinDeclarationTest extends PartialCodeTest { 'mixin A implements B,', [ ParserErrorCode.EXPECTED_TYPE_NAME, - ParserErrorCode.MISSING_CLASS_BODY + ParserErrorCode.EXPECTED_BODY ], 'mixin A implements B, _s_ {}', failing: ['functionVoid', 'functionNonVoid', 'getter', 'mixin']),