diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart index 341ab0271ccb..4f08d469664d 100644 --- a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart +++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart @@ -8355,6 +8355,16 @@ class Parser { listener.beginMetadataStar(start.next!); listener.endMetadataStar(/* count = */ 0); } + // Having settled on a variable declaration possibly do some error recovery. + if (beforeType.next!.isA(TokenType.LT)) { + // E.g. `final foo = [42];` where we're missing `List` before + // ``. + insertSyntheticIdentifier( + beforeType, IdentifierContext.localVariableDeclaration, + message: + codes.templateExpectedIdentifier.withArguments(beforeType.next!)); + typeInfo = computeType(beforeType, /* required = */ true); + } token = typeInfo.parseType(beforeType, this); next = token.next!; listener.beginVariablesDeclaration(next, lateToken, varFinalOrConst); diff --git a/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart b/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart new file mode 100644 index 000000000000..0b9026363aaf --- /dev/null +++ b/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart @@ -0,0 +1,8 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +foo() { + if(true) + final f = [42]; +} diff --git a/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart.expect b/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart.expect new file mode 100644 index 000000000000..7d2a30897b1c --- /dev/null +++ b/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart.expect @@ -0,0 +1,48 @@ +Problems reported: + +parser/error_recovery/bad_variable_in_if:7:11: Expected an identifier, but got '<'. + final f = [42]; + ^ + +beginCompilationUnit(foo) + beginMetadataStar(foo) + endMetadataStar(0) + beginTopLevelMember(foo) + beginTopLevelMethod(, null, null) + handleNoType() + handleIdentifier(foo, topLevelFunctionDeclaration) + handleNoTypeVariables(() + beginFormalParameters((, MemberKind.TopLevelMethod) + endFormalParameters(0, (, ), MemberKind.TopLevelMethod) + handleAsyncModifier(null, null) + beginBlockFunctionBody({) + beginIfStatement(if) + handleLiteralBool(true) + handleParenthesizedCondition((, null, null) + beginThenStatement(final) + beginMetadataStar(final) + endMetadataStar(0) + handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], <, <) + handleIdentifier(, typeReference) + beginTypeArguments(<) + handleIdentifier(int, typeReference) + handleNoTypeArguments(>) + handleType(int, null) + endTypeArguments(1, <, >) + handleType(, null) + beginVariablesDeclaration(f, null, final) + handleIdentifier(f, localVariableDeclaration) + beginInitializedIdentifier(f) + beginVariableInitializer(=) + handleNoTypeArguments([) + handleLiteralInt(42) + handleLiteralList(1, [, null, ]) + endVariableInitializer(=) + endInitializedIdentifier(f) + endVariablesDeclaration(1, ;) + endThenStatement(final, ;) + endIfStatement(if, null, ;) + endBlockFunctionBody(1, {, }) + endTopLevelMethod(foo, null, }) + endTopLevelDeclaration(}) +endCompilationUnit(1, ) diff --git a/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart.intertwined.expect new file mode 100644 index 000000000000..cc1575036b27 --- /dev/null +++ b/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart.intertwined.expect @@ -0,0 +1,94 @@ +parseUnit(foo) + skipErrorTokens(foo) + listener: beginCompilationUnit(foo) + syntheticPreviousToken(foo) + parseTopLevelDeclarationImpl(, DirectiveContext(DirectiveState.Unknown)) + parseMetadataStar() + listener: beginMetadataStar(foo) + listener: endMetadataStar(0) + parseTopLevelMemberImpl() + listener: beginTopLevelMember(foo) + isReservedKeyword(() + parseTopLevelMethod(, null, null, , NoType(), null, foo, false) + listener: beginTopLevelMethod(, null, null) + listener: handleNoType() + ensureIdentifierPotentiallyRecovered(, topLevelFunctionDeclaration, false) + listener: handleIdentifier(foo, topLevelFunctionDeclaration) + parseMethodTypeVar(foo) + listener: handleNoTypeVariables(() + parseGetterOrFormalParameters(foo, foo, false, MemberKind.TopLevelMethod) + parseFormalParameters(foo, MemberKind.TopLevelMethod) + parseFormalParametersRest((, MemberKind.TopLevelMethod) + listener: beginFormalParameters((, MemberKind.TopLevelMethod) + listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod) + parseAsyncModifierOpt()) + listener: handleAsyncModifier(null, null) + inPlainSync() + parseFunctionBody(), false, false) + listener: beginBlockFunctionBody({) + notEofOrValue(}, if) + parseStatement({) + parseStatementX({) + parseIfStatement({) + listener: beginIfStatement(if) + ensureParenthesizedCondition(if, allowCase: false) + parseExpressionInParenthesisRest((, allowCase: false) + parseExpression(() + parsePrecedenceExpression((, 1, true, ConstantPatternContext.none) + parseUnaryExpression((, true, ConstantPatternContext.none) + parsePrimary((, expression, ConstantPatternContext.none) + parseLiteralBool(() + listener: handleLiteralBool(true) + ensureCloseParen(true, () + listener: handleParenthesizedCondition((, null, null) + listener: beginThenStatement(final) + parseStatement()) + parseStatementX()) + parseExpressionStatementOrDeclarationAfterModifiers(final, ), null, final, null, null) + looksLikeLocalFunction(<) + listener: beginMetadataStar(final) + listener: endMetadataStar(0) + insertSyntheticIdentifier(final, localVariableDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], messageOnToken: null) + reportRecoverableError(<, Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}]) + listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], <, <) + rewriter() + listener: handleIdentifier(, typeReference) + listener: beginTypeArguments(<) + listener: handleIdentifier(int, typeReference) + listener: handleNoTypeArguments(>) + listener: handleType(int, null) + listener: endTypeArguments(1, <, >) + listener: handleType(, null) + listener: beginVariablesDeclaration(f, null, final) + parseVariablesDeclarationRest(>, true) + parseOptionallyInitializedIdentifier(>) + ensureIdentifier(>, localVariableDeclaration) + listener: handleIdentifier(f, localVariableDeclaration) + listener: beginInitializedIdentifier(f) + parseVariableInitializerOpt(f) + listener: beginVariableInitializer(=) + parseExpression(=) + parsePrecedenceExpression(=, 1, true, ConstantPatternContext.none) + parseUnaryExpression(=, true, ConstantPatternContext.none) + parsePrimary(=, expression, ConstantPatternContext.none) + listener: handleNoTypeArguments([) + parseLiteralListSuffix(=, null) + parseExpression([) + parsePrecedenceExpression([, 1, true, ConstantPatternContext.none) + parseUnaryExpression([, true, ConstantPatternContext.none) + parsePrimary([, expression, ConstantPatternContext.none) + parseLiteralInt([) + listener: handleLiteralInt(42) + listener: handleLiteralList(1, [, null, ]) + listener: endVariableInitializer(=) + listener: endInitializedIdentifier(f) + ensureSemicolon(]) + listener: endVariablesDeclaration(1, ;) + listener: endThenStatement(final, ;) + listener: endIfStatement(if, null, ;) + notEofOrValue(}, }) + listener: endBlockFunctionBody(1, {, }) + listener: endTopLevelMethod(foo, null, }) + listener: endTopLevelDeclaration(}) + reportAllErrorTokens(foo) + listener: endCompilationUnit(1, ) diff --git a/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart.parser.expect b/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart.parser.expect new file mode 100644 index 000000000000..844384e19645 --- /dev/null +++ b/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart.parser.expect @@ -0,0 +1,13 @@ +NOTICE: Stream was rewritten by parser! + +foo() { +if(true) +final *synthetic* f = [42]; +} + + +foo[StringToken]([BeginToken])[SimpleToken] {[BeginToken] +if[KeywordToken]([BeginToken]true[KeywordToken])[SimpleToken] +final[KeywordToken] [SyntheticStringToken]<[BeginToken]int[StringToken]>[SimpleToken] f[StringToken] =[SimpleToken] [[BeginToken]42[StringToken]][SimpleToken];[SimpleToken] +}[SimpleToken] +[SimpleToken] diff --git a/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart.scanner.expect b/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart.scanner.expect new file mode 100644 index 000000000000..9d4fd02536da --- /dev/null +++ b/pkg/front_end/parser_testcases/error_recovery/bad_variable_in_if.dart.scanner.expect @@ -0,0 +1,11 @@ +foo() { +if(true) +final f = [42]; +} + + +foo[StringToken]([BeginToken])[SimpleToken] {[BeginToken] +if[KeywordToken]([BeginToken]true[KeywordToken])[SimpleToken] +final[KeywordToken] <[BeginToken]int[StringToken]>[SimpleToken] f[StringToken] =[SimpleToken] [[BeginToken]42[StringToken]][SimpleToken];[SimpleToken] +}[SimpleToken] +[SimpleToken] diff --git a/pkg/front_end/testcases/regress/parser_recovery_01.dart.strong.expect b/pkg/front_end/testcases/regress/parser_recovery_01.dart.strong.expect index 83acb469629d..c3ea07426c6e 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_01.dart.strong.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_01.dart.strong.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_01.dart:7:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_01.dart:7:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_01.dart:7:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_01.dart:7:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_01.dart:12:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -51,15 +43,11 @@ library; // ^ // import self as self; +import "dart:core" as core; static method foo() → dynamic { while (true) { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_01.dart:6:3: Error: This couldn't be parsed. - while(true) - ^"; + final invalid-type f = [42]; } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_01.dart:7:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {} diff --git a/pkg/front_end/testcases/regress/parser_recovery_01.dart.strong.modular.expect b/pkg/front_end/testcases/regress/parser_recovery_01.dart.strong.modular.expect index 83acb469629d..c3ea07426c6e 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_01.dart.strong.modular.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_01.dart.strong.modular.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_01.dart:7:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_01.dart:7:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_01.dart:7:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_01.dart:7:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_01.dart:12:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -51,15 +43,11 @@ library; // ^ // import self as self; +import "dart:core" as core; static method foo() → dynamic { while (true) { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_01.dart:6:3: Error: This couldn't be parsed. - while(true) - ^"; + final invalid-type f = [42]; } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_01.dart:7:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {} diff --git a/pkg/front_end/testcases/regress/parser_recovery_01.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/parser_recovery_01.dart.strong.transformed.expect index 83acb469629d..4ec46e865e80 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_01.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_01.dart.strong.transformed.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_01.dart:7:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_01.dart:7:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_01.dart:7:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_01.dart:7:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_01.dart:12:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -51,15 +43,11 @@ library; // ^ // import self as self; +import "dart:core" as core; static method foo() → dynamic { while (true) { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_01.dart:6:3: Error: This couldn't be parsed. - while(true) - ^"; + final invalid-type f = core::_GrowableList::_literal1(42); } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_01.dart:7:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {} diff --git a/pkg/front_end/testcases/regress/parser_recovery_02.dart.strong.expect b/pkg/front_end/testcases/regress/parser_recovery_02.dart.strong.expect index 8b2c834a4db5..459ffa22c8b2 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_02.dart.strong.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_02.dart.strong.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_02.dart:7:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_02.dart:7:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_02.dart:7:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_02.dart:7:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_02.dart:12:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -51,15 +43,11 @@ library; // ^ // import self as self; +import "dart:core" as core; static method foo() → dynamic { if(true) { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_02.dart:6:3: Error: This couldn't be parsed. - if(true) - ^"; + final invalid-type f = [42]; } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_02.dart:7:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {} diff --git a/pkg/front_end/testcases/regress/parser_recovery_02.dart.strong.modular.expect b/pkg/front_end/testcases/regress/parser_recovery_02.dart.strong.modular.expect index 8b2c834a4db5..459ffa22c8b2 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_02.dart.strong.modular.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_02.dart.strong.modular.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_02.dart:7:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_02.dart:7:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_02.dart:7:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_02.dart:7:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_02.dart:12:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -51,15 +43,11 @@ library; // ^ // import self as self; +import "dart:core" as core; static method foo() → dynamic { if(true) { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_02.dart:6:3: Error: This couldn't be parsed. - if(true) - ^"; + final invalid-type f = [42]; } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_02.dart:7:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {} diff --git a/pkg/front_end/testcases/regress/parser_recovery_02.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/parser_recovery_02.dart.strong.transformed.expect index 8b2c834a4db5..73d10230f5f1 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_02.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_02.dart.strong.transformed.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_02.dart:7:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_02.dart:7:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_02.dart:7:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_02.dart:7:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_02.dart:12:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -51,15 +43,11 @@ library; // ^ // import self as self; +import "dart:core" as core; static method foo() → dynamic { if(true) { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_02.dart:6:3: Error: This couldn't be parsed. - if(true) - ^"; + final invalid-type f = core::_GrowableList::_literal1(42); } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_02.dart:7:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {} diff --git a/pkg/front_end/testcases/regress/parser_recovery_03.dart.strong.expect b/pkg/front_end/testcases/regress/parser_recovery_03.dart.strong.expect index 6f538633e9f6..4fcaa86ae4a1 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_03.dart.strong.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_03.dart.strong.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_03.dart:8:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_03.dart:8:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_03.dart:8:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_03.dart:8:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_03.dart:14:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -51,17 +43,13 @@ library; // ^ // import self as self; +import "dart:core" as core; static method foo() → dynamic { if(true) { } else { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_03.dart:7:3: Error: This couldn't be parsed. - else - ^"; + final invalid-type f = [42]; } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_03.dart:8:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {} diff --git a/pkg/front_end/testcases/regress/parser_recovery_03.dart.strong.modular.expect b/pkg/front_end/testcases/regress/parser_recovery_03.dart.strong.modular.expect index 6f538633e9f6..4fcaa86ae4a1 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_03.dart.strong.modular.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_03.dart.strong.modular.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_03.dart:8:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_03.dart:8:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_03.dart:8:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_03.dart:8:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_03.dart:14:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -51,17 +43,13 @@ library; // ^ // import self as self; +import "dart:core" as core; static method foo() → dynamic { if(true) { } else { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_03.dart:7:3: Error: This couldn't be parsed. - else - ^"; + final invalid-type f = [42]; } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_03.dart:8:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {} diff --git a/pkg/front_end/testcases/regress/parser_recovery_03.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/parser_recovery_03.dart.strong.transformed.expect index 6f538633e9f6..edb118eaec89 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_03.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_03.dart.strong.transformed.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_03.dart:8:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_03.dart:8:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_03.dart:8:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_03.dart:8:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_03.dart:14:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -51,17 +43,13 @@ library; // ^ // import self as self; +import "dart:core" as core; static method foo() → dynamic { if(true) { } else { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_03.dart:7:3: Error: This couldn't be parsed. - else - ^"; + final invalid-type f = core::_GrowableList::_literal1(42); } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_03.dart:8:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {} diff --git a/pkg/front_end/testcases/regress/parser_recovery_04.dart.strong.expect b/pkg/front_end/testcases/regress/parser_recovery_04.dart.strong.expect index 4efec5c4bda1..a924a8ed85f4 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_04.dart.strong.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_04.dart.strong.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_04.dart:7:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_04.dart:7:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_04.dart:7:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_04.dart:7:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_04.dart:12:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -55,12 +47,7 @@ import "dart:core" as core; static method foo() → dynamic { for (core::int i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_04.dart:7:12: Error: This couldn't be parsed. - final f = [42]; - ^"; + final invalid-type f = [42]; } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_04.dart:7:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {} diff --git a/pkg/front_end/testcases/regress/parser_recovery_04.dart.strong.modular.expect b/pkg/front_end/testcases/regress/parser_recovery_04.dart.strong.modular.expect index 4efec5c4bda1..a924a8ed85f4 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_04.dart.strong.modular.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_04.dart.strong.modular.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_04.dart:7:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_04.dart:7:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_04.dart:7:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_04.dart:7:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_04.dart:12:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -55,12 +47,7 @@ import "dart:core" as core; static method foo() → dynamic { for (core::int i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_04.dart:7:12: Error: This couldn't be parsed. - final f = [42]; - ^"; + final invalid-type f = [42]; } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_04.dart:7:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {} diff --git a/pkg/front_end/testcases/regress/parser_recovery_04.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/parser_recovery_04.dart.strong.transformed.expect index 4efec5c4bda1..84f4441b5349 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_04.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_04.dart.strong.transformed.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_04.dart:7:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_04.dart:7:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_04.dart:7:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_04.dart:7:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_04.dart:12:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -55,12 +47,7 @@ import "dart:core" as core; static method foo() → dynamic { for (core::int i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_04.dart:7:12: Error: This couldn't be parsed. - final f = [42]; - ^"; + final invalid-type f = core::_GrowableList::_literal1(42); } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_04.dart:7:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {} diff --git a/pkg/front_end/testcases/regress/parser_recovery_05.dart.strong.expect b/pkg/front_end/testcases/regress/parser_recovery_05.dart.strong.expect index 6634effc298d..0abb21743c33 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_05.dart.strong.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_05.dart.strong.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_05.dart:7:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_05.dart:7:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_05.dart:7:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_05.dart:7:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_05.dart:12:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -55,12 +47,7 @@ import "dart:core" as core; static method foo() → dynamic { for (core::int x in [1, 2, 3]) { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_05.dart:7:12: Error: This couldn't be parsed. - final f = [42]; - ^"; + final invalid-type f = [42]; } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_05.dart:7:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {} diff --git a/pkg/front_end/testcases/regress/parser_recovery_05.dart.strong.modular.expect b/pkg/front_end/testcases/regress/parser_recovery_05.dart.strong.modular.expect index 6634effc298d..0abb21743c33 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_05.dart.strong.modular.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_05.dart.strong.modular.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_05.dart:7:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_05.dart:7:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_05.dart:7:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_05.dart:7:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_05.dart:12:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -55,12 +47,7 @@ import "dart:core" as core; static method foo() → dynamic { for (core::int x in [1, 2, 3]) { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_05.dart:7:12: Error: This couldn't be parsed. - final f = [42]; - ^"; + final invalid-type f = [42]; } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_05.dart:7:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {} diff --git a/pkg/front_end/testcases/regress/parser_recovery_05.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/parser_recovery_05.dart.strong.transformed.expect index 83b0d770cee1..17bf8f3e4311 100644 --- a/pkg/front_end/testcases/regress/parser_recovery_05.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/regress/parser_recovery_05.dart.strong.transformed.expect @@ -7,18 +7,10 @@ library; // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_05.dart:7:11: Error: Expected ';' after this. +// pkg/front_end/testcases/regress/parser_recovery_05.dart:7:11: Error: This couldn't be parsed. // final f = [42]; // ^ // -// pkg/front_end/testcases/regress/parser_recovery_05.dart:7:17: Error: Undefined name 'f'. -// final f = [42]; -// ^ -// -// pkg/front_end/testcases/regress/parser_recovery_05.dart:7:19: Error: Can't assign to this. -// final f = [42]; -// ^ -// // pkg/front_end/testcases/regress/parser_recovery_05.dart:12:13: Error: Undefined name 'a'. // var y = a?.c = 42; // ^ @@ -59,14 +51,9 @@ static method foo() → dynamic { for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) { core::int x = :sync-for-iterator.{core::Iterator::current}{core::int}; { - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_05.dart:7:12: Error: This couldn't be parsed. - final f = [42]; - ^"; + final invalid-type f = core::_GrowableList::_literal1(42); } } } - invalid-expression "pkg/front_end/testcases/regress/parser_recovery_05.dart:7:19: Error: Can't assign to this. - final f = [42]; - ^"; } static method bar() → dynamic {}