Version 2.13.0-167.0.dev
Merge commit 'ac9b4aab8d5ebb598907c8d07a742756dce5a2ff' into 'dev'
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index 7868cb7..96608e0 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -6308,6 +6308,65 @@
message: r"""List literal requires exactly one type argument.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<Message Function(String string, Token token)>
+ templateLiteralWithClass =
+ const Template<Message Function(String string, Token token)>(
+ messageTemplate:
+ r"""A #string literal can't be prefixed by '#lexeme'.""",
+ tipTemplate: r"""Try removing '#lexeme'""",
+ withArguments: _withArgumentsLiteralWithClass);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String string, Token token)> codeLiteralWithClass =
+ const Code<Message Function(String string, Token token)>("LiteralWithClass",
+ index: 116);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsLiteralWithClass(String string, Token token) {
+ if (string.isEmpty) throw 'No string provided';
+ String lexeme = token.lexeme;
+ return new Message(codeLiteralWithClass,
+ message: """A ${string} literal can't be prefixed by '${lexeme}'.""",
+ tip: """Try removing '${lexeme}'""",
+ arguments: {'string': string, 'lexeme': token});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<Message Function(String string, Token token)>
+ templateLiteralWithClassAndNew =
+ const Template<Message Function(String string, Token token)>(
+ messageTemplate:
+ r"""A #string literal can't be prefixed by 'new #lexeme'.""",
+ tipTemplate: r"""Try removing 'new' and '#lexeme'""",
+ withArguments: _withArgumentsLiteralWithClassAndNew);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String string, Token token)>
+ codeLiteralWithClassAndNew =
+ const Code<Message Function(String string, Token token)>(
+ "LiteralWithClassAndNew",
+ index: 115);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsLiteralWithClassAndNew(String string, Token token) {
+ if (string.isEmpty) throw 'No string provided';
+ String lexeme = token.lexeme;
+ return new Message(codeLiteralWithClassAndNew,
+ message: """A ${string} literal can't be prefixed by 'new ${lexeme}'.""",
+ tip: """Try removing 'new' and '${lexeme}'""",
+ arguments: {'string': string, 'lexeme': token});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeLiteralWithNew = messageLiteralWithNew;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageLiteralWithNew = const MessageCode("LiteralWithNew",
+ index: 117,
+ message: r"""A literal can't be prefixed by 'new'.""",
+ tip: r"""Try removing 'new'""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeLoadLibraryTakesNoArguments =
messageLoadLibraryTakesNoArguments;
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 a1749b6..1fe9144 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
@@ -2412,13 +2412,7 @@
/// Checks whether the next token is (directly) an identifier. If this returns
/// true a call to [ensureIdentifier] will return the next token.
- bool isNextIdentifier(Token token) {
- Token identifier = token.next!;
- if (identifier.kind != IDENTIFIER_TOKEN) {
- return false;
- }
- return true;
- }
+ bool isNextIdentifier(Token token) => token.next?.kind == IDENTIFIER_TOKEN;
/// Parse a simple identifier at the given [token], and return the identifier
/// that was parsed.
@@ -5771,10 +5765,11 @@
if (optional('{', afterToken)) {
// Recover by ignoring both the `new` and the `Map`/`Set` and parse as
// a literal map/set.
- reportRecoverableErrorWithToken(
- newKeyword, codes.templateUnexpectedToken);
- reportRecoverableErrorWithToken(
- identifier, codes.templateUnexpectedToken);
+ reportRecoverableErrorWithEnd(
+ newKeyword,
+ identifier,
+ codes.templateLiteralWithClassAndNew
+ .withArguments(value.toLowerCase(), identifier));
return parsePrimary(identifier, IdentifierContext.expression);
}
} else if (value == "List" && !optional('.', identifier.next!)) {
@@ -5783,10 +5778,11 @@
if (optional('[', afterToken) || optional('[]', afterToken)) {
// Recover by ignoring both the `new` and the `List` and parse as
// a literal list.
- reportRecoverableErrorWithToken(
- newKeyword, codes.templateUnexpectedToken);
- reportRecoverableErrorWithToken(
- identifier, codes.templateUnexpectedToken);
+ reportRecoverableErrorWithEnd(
+ newKeyword,
+ identifier,
+ codes.templateLiteralWithClassAndNew
+ .withArguments(value.toLowerCase(), identifier));
return parsePrimary(identifier, IdentifierContext.expression);
}
}
@@ -5804,14 +5800,12 @@
optional('[', afterToken) ||
optional('[]', afterToken)) {
// Recover by ignoring the `new` and parse as a literal map/set/list.
- reportRecoverableErrorWithToken(
- newKeyword, codes.templateUnexpectedToken);
+ reportRecoverableError(newKeyword, codes.messageLiteralWithNew);
return parsePrimary(newKeyword, IdentifierContext.expression);
}
} else if (value == "{" || value == "[" || value == "[]") {
// Recover by ignoring the `new` and parse as a literal map/set/list.
- reportRecoverableErrorWithToken(
- newKeyword, codes.templateUnexpectedToken);
+ reportRecoverableError(newKeyword, codes.messageLiteralWithNew);
return parsePrimary(newKeyword, IdentifierContext.expression);
}
}
@@ -5886,7 +5880,10 @@
final String? nextValue = nextNext.stringValue;
if (identical(nextValue, '{')) {
// Recover by ignoring the `Map`/`Set` and parse as a literal map/set.
- reportRecoverableErrorWithToken(next, codes.templateUnexpectedToken);
+ reportRecoverableError(
+ next,
+ codes.templateLiteralWithClass
+ .withArguments(lexeme.toLowerCase(), next));
listener.beginConstLiteral(nextNext);
listener.handleNoTypeArguments(nextNext);
token = parseLiteralSetOrMapSuffix(next, constKeyword);
@@ -5895,7 +5892,11 @@
}
if (identical(nextValue, '<')) {
// Recover by ignoring the `Map`/`Set` and parse as a literal map/set.
- reportRecoverableErrorWithToken(next, codes.templateUnexpectedToken);
+ reportRecoverableError(
+ next,
+ codes.templateLiteralWithClass
+ .withArguments(lexeme.toLowerCase(), next));
+
listener.beginConstLiteral(nextNext);
token = parseLiteralListSetMapOrFunction(next, constKeyword);
listener.endConstLiteral(token.next!);
@@ -5911,7 +5912,10 @@
final String? nextValue = nextNext.stringValue;
if (identical(nextValue, '[') || identical(nextValue, '[]')) {
// Recover by ignoring the `List` and parse as a literal list.
- reportRecoverableErrorWithToken(next, codes.templateUnexpectedToken);
+ reportRecoverableError(
+ next,
+ codes.templateLiteralWithClass
+ .withArguments(lexeme.toLowerCase(), next));
listener.beginConstLiteral(nextNext);
listener.handleNoTypeArguments(nextNext);
token = parseLiteralListSuffix(next, constKeyword);
@@ -5920,7 +5924,10 @@
}
if (identical(nextValue, '<')) {
// Recover by ignoring the `List` and parse as a literal list.
- reportRecoverableErrorWithToken(next, codes.templateUnexpectedToken);
+ reportRecoverableError(
+ next,
+ codes.templateLiteralWithClass
+ .withArguments(lexeme.toLowerCase(), next));
listener.beginConstLiteral(nextNext);
token = parseLiteralListSetMapOrFunction(next, constKeyword);
listener.endConstLiteral(token.next!);
@@ -6100,8 +6107,10 @@
afterToken = potentialTypeArg.skip(identifier).next!;
if (optional('{', afterToken)) {
// Recover by ignoring the `Map`/`Set` and parse as a literal map/set.
- reportRecoverableErrorWithToken(
- identifier, codes.templateUnexpectedToken);
+ reportRecoverableError(
+ identifier,
+ codes.templateLiteralWithClass
+ .withArguments(value.toLowerCase(), identifier));
return parsePrimary(identifier, context);
}
} else if (value == "List") {
@@ -6114,8 +6123,10 @@
// Note that we here require the `<...>` for `[` as `List[` would be
// an indexed expression. `List[]` wouldn't though, so we don't
// require it there.
- reportRecoverableErrorWithToken(
- identifier, codes.templateUnexpectedToken);
+ reportRecoverableError(
+ identifier,
+ codes.templateLiteralWithClass
+ .withArguments(value.toLowerCase(), identifier));
return parsePrimary(identifier, context);
}
}
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index c83a346..10488ef 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -734,6 +734,9 @@
ParserErrorCode.INVALID_UNICODE_ESCAPE,
ParserErrorCode.INVALID_USE_OF_COVARIANT_IN_EXTENSION,
ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST,
+ ParserErrorCode.LITERAL_WITH_CLASS_AND_NEW,
+ ParserErrorCode.LITERAL_WITH_CLASS,
+ ParserErrorCode.LITERAL_WITH_NEW,
ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER,
ParserErrorCode.MEMBER_WITH_CLASS_NAME,
ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR,
diff --git a/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart b/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
index e881af8..e1358f1 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
@@ -555,6 +555,13 @@
static const ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST =
_LIBRARY_DIRECTIVE_NOT_FIRST;
+ static const ParserErrorCode LITERAL_WITH_CLASS_AND_NEW =
+ _LITERAL_WITH_CLASS_AND_NEW;
+
+ static const ParserErrorCode LITERAL_WITH_CLASS = _LITERAL_WITH_CLASS;
+
+ static const ParserErrorCode LITERAL_WITH_NEW = _LITERAL_WITH_NEW;
+
static const ParserErrorCode LOCAL_FUNCTION_DECLARATION_MODIFIER =
ParserErrorCode('LOCAL_FUNCTION_DECLARATION_MODIFIER',
"Local function declarations can't specify any modifiers.",
diff --git a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
index 5265c24..36a49fe 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
@@ -122,6 +122,9 @@
_BINARY_OPERATOR_WRITTEN_OUT,
_EXPECTED_IDENTIFIER_BUT_GOT_KEYWORD,
_ANNOTATION_WITH_TYPE_ARGUMENTS_UNINSTANTIATED,
+ _LITERAL_WITH_CLASS_AND_NEW,
+ _LITERAL_WITH_CLASS,
+ _LITERAL_WITH_NEW,
];
const ParserErrorCode _ABSTRACT_CLASS_MEMBER = ParserErrorCode(
@@ -474,6 +477,20 @@
correction:
"Try moving the library directive before any other directives.");
+const ParserErrorCode _LITERAL_WITH_CLASS = ParserErrorCode(
+ 'LITERAL_WITH_CLASS',
+ r"The name of the class '#lexeme' can't be included in a #string literal.",
+ correction: "Try removing '#lexeme'");
+
+const ParserErrorCode _LITERAL_WITH_CLASS_AND_NEW = ParserErrorCode(
+ 'LITERAL_WITH_CLASS_AND_NEW',
+ r"Neither 'new' nor the name of the class '#lexeme' can be included in a #string literal.",
+ correction: "Try removing 'new' and '#lexeme'");
+
+const ParserErrorCode _LITERAL_WITH_NEW = ParserErrorCode(
+ 'LITERAL_WITH_NEW', r"A literal can't use 'new'.",
+ correction: "Try removing 'new'");
+
const ParserErrorCode _MEMBER_WITH_CLASS_NAME = ParserErrorCode(
'MEMBER_WITH_CLASS_NAME',
r"A class member can't have the same name as the enclosing class.",
diff --git a/pkg/analyzer/test/generated/recovery_parser_test.dart b/pkg/analyzer/test/generated/recovery_parser_test.dart
index b946115..1abb18e 100644
--- a/pkg/analyzer/test/generated/recovery_parser_test.dart
+++ b/pkg/analyzer/test/generated/recovery_parser_test.dart
@@ -1034,7 +1034,13 @@
void test_invalidMapLiteral() {
parseCompilationUnit("class C { var f = Map<A, B> {}; }", codes: [
- ParserErrorCode.UNEXPECTED_TOKEN,
+ ParserErrorCode.LITERAL_WITH_CLASS,
+ ]);
+ parseCompilationUnit("class C { var f = new Map<A, B> {}; }", codes: [
+ ParserErrorCode.LITERAL_WITH_CLASS_AND_NEW,
+ ]);
+ parseCompilationUnit("class C { var f = new <A, B> {}; }", codes: [
+ ParserErrorCode.LITERAL_WITH_NEW,
]);
}
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 302322a..c5be3f5 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -1248,6 +1248,54 @@
script:
- "import 'b.dart' d as b;"
+LiteralWithClassAndNew:
+ template: "A #string literal can't be prefixed by 'new #lexeme'."
+ tip: "Try removing 'new' and '#lexeme'"
+ analyzerCode: ParserErrorCode.LITERAL_WITH_CLASS_AND_NEW
+ index: 115
+ script:
+ - "var x = new Map{};"
+ - "var x = new Set{};"
+ - "var x = new List[];"
+ - "var x = new Map{1: 2};"
+ - "var x = new Set{1};"
+ - "var x = new List[1];"
+
+LiteralWithClass:
+ template: "A #string literal can't be prefixed by '#lexeme'."
+ tip: "Try removing '#lexeme'"
+ analyzerCode: ParserErrorCode.LITERAL_WITH_CLASS
+ index: 116
+ script:
+ - "var x = Map{};"
+ - "var x = Set{};"
+ - "var x = List<String>[];"
+ - "var x = Map{1: 2};"
+ - "var x = Set{1};"
+ - "var x = List<int>[1];"
+ - "var x = const Map{};"
+ - "var x = const Set{};"
+ - "var x = const List[];"
+ - "var x = const Map{1: 2};"
+ - "var x = const Set{1};"
+ - "var x = const List[1];"
+
+LiteralWithNew:
+ template: "A literal can't be prefixed by 'new'."
+ tip: "Try removing 'new'"
+ analyzerCode: ParserErrorCode.LITERAL_WITH_NEW
+ index: 117
+ script:
+ - "var x = new <String, String>{};"
+ - "var x = new <String>{};"
+ - "var x = new {};"
+ - "var x = new [];"
+ - "var x = new <String, String>{'a': 'b'};"
+ - "var x = new <String>{'a'};"
+ - "var x = new {'a': 'b'};"
+ - "var x = new {'a'};"
+ - "var x = new ['a'];"
+
UnmatchedToken:
template: "Can't find '#string' to match '#lexeme'."
analyzerCode: EXPECTED_TOKEN
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251.dart.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251.dart.expect
index 898cf57..702b63b 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251.dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251.dart.expect
@@ -1,18 +1,18 @@
Problems reported:
-parser/error_recovery/issue_45251:3:39: Unexpected token 'Map'.
+parser/error_recovery/issue_45251:3:39: A map literal can't be prefixed by 'Map'.
final Map<String, Undefined> foo1 = Map<String, List<int>>{};
^^^
-parser/error_recovery/issue_45251:9:39: Unexpected token 'Map'.
+parser/error_recovery/issue_45251:9:39: A map literal can't be prefixed by 'Map'.
final Map<String, Undefined> foo3 = Map{};
^^^
-parser/error_recovery/issue_45251:18:39: Unexpected token 'Map'.
+parser/error_recovery/issue_45251:18:39: A map literal can't be prefixed by 'Map'.
final Map<String, Undefined> foo6 = Map<String, List<int>>{"a": null};
^^^
-parser/error_recovery/issue_45251:21:39: Unexpected token 'Map'.
+parser/error_recovery/issue_45251:21:39: A map literal can't be prefixed by 'Map'.
final Map<String, Undefined> foo7 = Map{"a": null};
^^^
@@ -45,7 +45,7 @@
handleType(Map, null)
handleIdentifier(foo1, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
beginTypeArguments(<)
handleIdentifier(String, typeReference)
handleNoTypeArguments(,)
@@ -110,7 +110,7 @@
handleType(Map, null)
handleIdentifier(foo3, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
handleNoTypeArguments({)
handleLiteralSetOrMap(0, {, null, }, false)
endFieldInitializer(=, ;)
@@ -191,7 +191,7 @@
handleType(Map, null)
handleIdentifier(foo6, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
beginTypeArguments(<)
handleIdentifier(String, typeReference)
handleNoTypeArguments(,)
@@ -228,7 +228,7 @@
handleType(Map, null)
handleIdentifier(foo7, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
handleNoTypeArguments({)
beginLiteralString("a")
endLiteralString(0, :)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251.dart.intertwined.expect
index 3e01156..8e981b1 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251.dart.intertwined.expect
@@ -55,8 +55,8 @@
parsePrimary(=, expression)
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
- reportRecoverableErrorWithToken(Map, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ reportRecoverableError(Map, Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
parsePrimary(Map, expression)
parseLiteralListSetMapOrFunction(Map, null)
listener: beginTypeArguments(<)
@@ -150,8 +150,8 @@
parsePrimary(=, expression)
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
- reportRecoverableErrorWithToken(Map, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ reportRecoverableError(Map, Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
parsePrimary(Map, expression)
listener: handleNoTypeArguments({)
parseLiteralSetOrMapSuffix(Map, null)
@@ -283,8 +283,8 @@
parsePrimary(=, expression)
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
- reportRecoverableErrorWithToken(Map, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ reportRecoverableError(Map, Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
parsePrimary(Map, expression)
parseLiteralListSetMapOrFunction(Map, null)
listener: beginTypeArguments(<)
@@ -348,8 +348,8 @@
parsePrimary(=, expression)
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
- reportRecoverableErrorWithToken(Map, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ reportRecoverableError(Map, Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
parsePrimary(Map, expression)
listener: handleNoTypeArguments({)
parseLiteralSetOrMapSuffix(Map, null)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_const.dart.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_const.dart.expect
index 34a2a61..0291006 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_const.dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_const.dart.expect
@@ -1,18 +1,18 @@
Problems reported:
-parser/error_recovery/issue_45251_const:3:45: Unexpected token 'Map'.
+parser/error_recovery/issue_45251_const:3:45: A map literal can't be prefixed by 'Map'.
final Map<String, Undefined> foo1 = const Map<String, List<int>>{};
^^^
-parser/error_recovery/issue_45251_const:9:45: Unexpected token 'Map'.
+parser/error_recovery/issue_45251_const:9:45: A map literal can't be prefixed by 'Map'.
final Map<String, Undefined> foo3 = const Map{};
^^^
-parser/error_recovery/issue_45251_const:18:45: Unexpected token 'Map'.
+parser/error_recovery/issue_45251_const:18:45: A map literal can't be prefixed by 'Map'.
final Map<String, Undefined> foo6 = const Map<String, List<int>>{"a": null};
^^^
-parser/error_recovery/issue_45251_const:21:45: Unexpected token 'Map'.
+parser/error_recovery/issue_45251_const:21:45: A map literal can't be prefixed by 'Map'.
final Map<String, Undefined> foo7 = const Map{"a": null};
^^^
@@ -45,7 +45,7 @@
handleType(Map, null)
handleIdentifier(foo1, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
beginConstLiteral(<)
beginTypeArguments(<)
handleIdentifier(String, typeReference)
@@ -114,7 +114,7 @@
handleType(Map, null)
handleIdentifier(foo3, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
beginConstLiteral({)
handleNoTypeArguments({)
handleLiteralSetOrMap(0, {, const, }, false)
@@ -205,7 +205,7 @@
handleType(Map, null)
handleIdentifier(foo6, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
beginConstLiteral(<)
beginTypeArguments(<)
handleIdentifier(String, typeReference)
@@ -244,7 +244,7 @@
handleType(Map, null)
handleIdentifier(foo7, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
beginConstLiteral({)
handleNoTypeArguments({)
beginLiteralString("a")
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_const.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_const.dart.intertwined.expect
index 7637c4b..3d2e81d 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_const.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_const.dart.intertwined.expect
@@ -54,8 +54,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseConstExpression(=)
- reportRecoverableErrorWithToken(Map, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ reportRecoverableError(Map, Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
listener: beginConstLiteral(<)
parseLiteralListSetMapOrFunction(Map, const)
listener: beginTypeArguments(<)
@@ -152,8 +152,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseConstExpression(=)
- reportRecoverableErrorWithToken(Map, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ reportRecoverableError(Map, Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
listener: beginConstLiteral({)
listener: handleNoTypeArguments({)
parseLiteralSetOrMapSuffix(Map, const)
@@ -291,8 +291,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseConstExpression(=)
- reportRecoverableErrorWithToken(Map, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ reportRecoverableError(Map, Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
listener: beginConstLiteral(<)
parseLiteralListSetMapOrFunction(Map, const)
listener: beginTypeArguments(<)
@@ -356,8 +356,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseConstExpression(=)
- reportRecoverableErrorWithToken(Map, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ reportRecoverableError(Map, Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A map literal can't be prefixed by 'Map'., Try removing 'Map', {string: map, lexeme: Map}], Map, Map)
listener: beginConstLiteral({)
listener: handleNoTypeArguments({)
parseLiteralSetOrMapSuffix(Map, const)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list.dart.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list.dart.expect
index b044323..f5c21fa 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list.dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list.dart.expect
@@ -1,14 +1,14 @@
Problems reported:
-parser/error_recovery/issue_45251_list:3:32: Unexpected token 'List'.
+parser/error_recovery/issue_45251_list:3:32: A list literal can't be prefixed by 'List'.
final List<Undefined> foo1 = List<List<int>>[];
^^^^
-parser/error_recovery/issue_45251_list:9:32: Unexpected token 'List'.
+parser/error_recovery/issue_45251_list:9:32: A list literal can't be prefixed by 'List'.
final List<Undefined> foo3 = List[];
^^^^
-parser/error_recovery/issue_45251_list:18:32: Unexpected token 'List'.
+parser/error_recovery/issue_45251_list:18:32: A list literal can't be prefixed by 'List'.
final List<Undefined> foo6 = List<List<int>>[null];
^^^^
@@ -38,7 +38,7 @@
handleType(List, null)
handleIdentifier(foo1, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ handleRecoverableError(Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}], List, List)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
beginTypeArguments(<)
@@ -91,7 +91,7 @@
handleType(List, null)
handleIdentifier(foo3, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ handleRecoverableError(Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}], List, List)
handleNoTypeArguments([])
handleLiteralList(0, [, null, ])
endFieldInitializer(=, ;)
@@ -160,7 +160,7 @@
handleType(List, null)
handleIdentifier(foo6, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ handleRecoverableError(Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}], List, List)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
beginTypeArguments(<)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list.dart.intertwined.expect
index 2194596..a073268 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list.dart.intertwined.expect
@@ -51,8 +51,8 @@
parsePrimary(=, expression)
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
- reportRecoverableErrorWithToken(List, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ reportRecoverableError(List, Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}], List, List)
parsePrimary(List, expression)
parseLiteralListSetMapOrFunction(List, null)
listener: beginTypeArguments(<)
@@ -138,8 +138,8 @@
parsePrimary(=, expression)
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
- reportRecoverableErrorWithToken(List, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ reportRecoverableError(List, Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}], List, List)
parsePrimary(List, expression)
listener: handleNoTypeArguments([])
parseLiteralListSuffix(List, null)
@@ -259,8 +259,8 @@
parsePrimary(=, expression)
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
- reportRecoverableErrorWithToken(List, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ reportRecoverableError(List, Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}], List, List)
parsePrimary(List, expression)
parseLiteralListSetMapOrFunction(List, null)
listener: beginTypeArguments(<)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_const.dart.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_const.dart.expect
index 9c4318d..0f278c9 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_const.dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_const.dart.expect
@@ -1,18 +1,18 @@
Problems reported:
-parser/error_recovery/issue_45251_list_const:3:38: Unexpected token 'List'.
+parser/error_recovery/issue_45251_list_const:3:38: A list literal can't be prefixed by 'List'.
final List<Undefined> foo1 = const List<List<int>>[];
^^^^
-parser/error_recovery/issue_45251_list_const:9:38: Unexpected token 'List'.
+parser/error_recovery/issue_45251_list_const:9:38: A list literal can't be prefixed by 'List'.
final List<Undefined> foo3 = const List[];
^^^^
-parser/error_recovery/issue_45251_list_const:18:38: Unexpected token 'List'.
+parser/error_recovery/issue_45251_list_const:18:38: A list literal can't be prefixed by 'List'.
final List<Undefined> foo6 = const List<List<int>>[null];
^^^^
-parser/error_recovery/issue_45251_list_const:22:38: Unexpected token 'List'.
+parser/error_recovery/issue_45251_list_const:22:38: A list literal can't be prefixed by 'List'.
final List<Undefined> foo7 = const List[null];
^^^^
@@ -42,7 +42,7 @@
handleType(List, null)
handleIdentifier(foo1, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ handleRecoverableError(Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}], List, List)
beginConstLiteral(<)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
@@ -99,7 +99,7 @@
handleType(List, null)
handleIdentifier(foo3, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ handleRecoverableError(Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}], List, List)
beginConstLiteral([])
handleNoTypeArguments([])
handleLiteralList(0, [, const, ])
@@ -178,7 +178,7 @@
handleType(List, null)
handleIdentifier(foo6, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ handleRecoverableError(Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}], List, List)
beginConstLiteral(<)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
@@ -208,7 +208,7 @@
handleType(List, null)
handleIdentifier(foo7, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ handleRecoverableError(Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}], List, List)
beginConstLiteral([)
handleNoTypeArguments([)
handleLiteralNull(null)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_const.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_const.dart.intertwined.expect
index 310f11d..84d3ed8 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_const.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_const.dart.intertwined.expect
@@ -50,8 +50,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseConstExpression(=)
- reportRecoverableErrorWithToken(List, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ reportRecoverableError(List, Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}], List, List)
listener: beginConstLiteral(<)
parseLiteralListSetMapOrFunction(List, const)
listener: beginTypeArguments(<)
@@ -140,8 +140,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseConstExpression(=)
- reportRecoverableErrorWithToken(List, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ reportRecoverableError(List, Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}], List, List)
listener: beginConstLiteral([])
listener: handleNoTypeArguments([])
parseLiteralListSuffix(List, const)
@@ -267,8 +267,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseConstExpression(=)
- reportRecoverableErrorWithToken(List, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ reportRecoverableError(List, Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}], List, List)
listener: beginConstLiteral(<)
parseLiteralListSetMapOrFunction(List, const)
listener: beginTypeArguments(<)
@@ -316,8 +316,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseConstExpression(=)
- reportRecoverableErrorWithToken(List, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ reportRecoverableError(List, Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A list literal can't be prefixed by 'List'., Try removing 'List', {string: list, lexeme: List}], List, List)
listener: beginConstLiteral([)
listener: handleNoTypeArguments([)
parseLiteralListSuffix(List, const)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_new.dart.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_new.dart.expect
index af78fd6..447db69 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_new.dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_new.dart.expect
@@ -1,46 +1,30 @@
Problems reported:
-parser/error_recovery/issue_45251_list_new:3:32: Unexpected token 'new'.
+parser/error_recovery/issue_45251_list_new:3:32: A list literal can't be prefixed by 'new List'.
final List<Undefined> foo1 = new List<List<int>>[];
- ^^^
+ ^^^^^^^^
-parser/error_recovery/issue_45251_list_new:3:36: Unexpected token 'List'.
- final List<Undefined> foo1 = new List<List<int>>[];
- ^^^^
-
-parser/error_recovery/issue_45251_list_new:6:32: Unexpected token 'new'.
+parser/error_recovery/issue_45251_list_new:6:32: A literal can't be prefixed by 'new'.
final List<Undefined> foo2 = new <List<int>>[];
^^^
-parser/error_recovery/issue_45251_list_new:9:32: Unexpected token 'new'.
+parser/error_recovery/issue_45251_list_new:9:32: A list literal can't be prefixed by 'new List'.
final List<Undefined> foo3 = new List[];
- ^^^
+ ^^^^^^^^
-parser/error_recovery/issue_45251_list_new:9:36: Unexpected token 'List'.
- final List<Undefined> foo3 = new List[];
- ^^^^
-
-parser/error_recovery/issue_45251_list_new:18:32: Unexpected token 'new'.
+parser/error_recovery/issue_45251_list_new:18:32: A list literal can't be prefixed by 'new List'.
final List<Undefined> foo6 = new List<List<int>>[null];
- ^^^
+ ^^^^^^^^
-parser/error_recovery/issue_45251_list_new:18:36: Unexpected token 'List'.
- final List<Undefined> foo6 = new List<List<int>>[null];
- ^^^^
-
-parser/error_recovery/issue_45251_list_new:22:32: Unexpected token 'new'.
+parser/error_recovery/issue_45251_list_new:22:32: A list literal can't be prefixed by 'new List'.
final List<Undefined> foo7 = new List[null];
- ^^^
+ ^^^^^^^^
-parser/error_recovery/issue_45251_list_new:22:36: Unexpected token 'List'.
- final List<Undefined> foo7 = new List[null];
- ^^^^
-
-parser/error_recovery/issue_45251_list_new:25:32: Unexpected token 'new'.
+parser/error_recovery/issue_45251_list_new:25:32: A literal can't be prefixed by 'new'.
final List<Undefined> foo8 = new <List<int>>[null];
^^^
-parser/error_recovery/issue_45251_list_new:28:32: Unexpected token 'new'.
+parser/error_recovery/issue_45251_list_new:28:32: A literal can't be prefixed by 'new'.
final List<Undefined> foo9 = new [null];
^^^
@@ -70,8 +54,7 @@
handleType(List, null)
handleIdentifier(foo1, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ handleRecoverableError(Message[LiteralWithClassAndNew, A list literal can't be prefixed by 'new List'., Try removing 'new' and 'List', {string: list, lexeme: List}], new, List)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
beginTypeArguments(<)
@@ -98,7 +81,7 @@
handleType(List, null)
handleIdentifier(foo2, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ handleRecoverableError(LiteralWithNew, new, new)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
beginTypeArguments(<)
@@ -125,8 +108,7 @@
handleType(List, null)
handleIdentifier(foo3, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ handleRecoverableError(Message[LiteralWithClassAndNew, A list literal can't be prefixed by 'new List'., Try removing 'new' and 'List', {string: list, lexeme: List}], new, List)
handleNoTypeArguments([])
handleLiteralList(0, [, null, ])
endFieldInitializer(=, ;)
@@ -203,8 +185,7 @@
handleType(List, null)
handleIdentifier(foo6, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ handleRecoverableError(Message[LiteralWithClassAndNew, A list literal can't be prefixed by 'new List'., Try removing 'new' and 'List', {string: list, lexeme: List}], new, List)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
beginTypeArguments(<)
@@ -232,8 +213,7 @@
handleType(List, null)
handleIdentifier(foo7, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ handleRecoverableError(Message[LiteralWithClassAndNew, A list literal can't be prefixed by 'new List'., Try removing 'new' and 'List', {string: list, lexeme: List}], new, List)
handleNoTypeArguments([)
handleLiteralNull(null)
handleLiteralList(1, [, null, ])
@@ -253,7 +233,7 @@
handleType(List, null)
handleIdentifier(foo8, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ handleRecoverableError(LiteralWithNew, new, new)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
beginTypeArguments(<)
@@ -281,7 +261,7 @@
handleType(List, null)
handleIdentifier(foo9, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ handleRecoverableError(LiteralWithNew, new, new)
handleNoTypeArguments([)
handleLiteralNull(null)
handleLiteralList(1, [, null, ])
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_new.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_new.dart.intertwined.expect
index bad29ab..9dd8aca 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_new.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_new.dart.intertwined.expect
@@ -50,10 +50,7 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- reportRecoverableErrorWithToken(List, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ listener: handleRecoverableError(Message[LiteralWithClassAndNew, A list literal can't be prefixed by 'new List'., Try removing 'new' and 'List', {string: list, lexeme: List}], new, List)
parsePrimary(List, expression)
parseLiteralListSetMapOrFunction(List, null)
listener: beginTypeArguments(<)
@@ -97,8 +94,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ reportRecoverableError(new, LiteralWithNew)
+ listener: handleRecoverableError(LiteralWithNew, new, new)
parsePrimary(new, expression)
parseLiteralListSetMapOrFunction(new, null)
listener: beginTypeArguments(<)
@@ -142,10 +139,7 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- reportRecoverableErrorWithToken(List, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ listener: handleRecoverableError(Message[LiteralWithClassAndNew, A list literal can't be prefixed by 'new List'., Try removing 'new' and 'List', {string: list, lexeme: List}], new, List)
parsePrimary(List, expression)
listener: handleNoTypeArguments([])
parseLiteralListSuffix(List, null)
@@ -270,10 +264,7 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- reportRecoverableErrorWithToken(List, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ listener: handleRecoverableError(Message[LiteralWithClassAndNew, A list literal can't be prefixed by 'new List'., Try removing 'new' and 'List', {string: list, lexeme: List}], new, List)
parsePrimary(List, expression)
parseLiteralListSetMapOrFunction(List, null)
listener: beginTypeArguments(<)
@@ -320,10 +311,7 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- reportRecoverableErrorWithToken(List, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'List'., null, {lexeme: List}], List, List)
+ listener: handleRecoverableError(Message[LiteralWithClassAndNew, A list literal can't be prefixed by 'new List'., Try removing 'new' and 'List', {string: list, lexeme: List}], new, List)
parsePrimary(List, expression)
listener: handleNoTypeArguments([)
parseLiteralListSuffix(List, null)
@@ -361,8 +349,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ reportRecoverableError(new, LiteralWithNew)
+ listener: handleRecoverableError(LiteralWithNew, new, new)
parsePrimary(new, expression)
parseLiteralListSetMapOrFunction(new, null)
listener: beginTypeArguments(<)
@@ -409,8 +397,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ reportRecoverableError(new, LiteralWithNew)
+ listener: handleRecoverableError(LiteralWithNew, new, new)
parsePrimary(new, expression)
listener: handleNoTypeArguments([)
parseLiteralListSuffix(new, null)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_new.dart.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_new.dart.expect
index 7854a53..c1b095d 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_new.dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_new.dart.expect
@@ -1,46 +1,30 @@
Problems reported:
-parser/error_recovery/issue_45251_new:3:39: Unexpected token 'new'.
+parser/error_recovery/issue_45251_new:3:39: A map literal can't be prefixed by 'new Map'.
final Map<String, Undefined> foo1 = new Map<String, List<int>>{};
- ^^^
+ ^^^^^^^
-parser/error_recovery/issue_45251_new:3:43: Unexpected token 'Map'.
- final Map<String, Undefined> foo1 = new Map<String, List<int>>{};
- ^^^
-
-parser/error_recovery/issue_45251_new:6:39: Unexpected token 'new'.
+parser/error_recovery/issue_45251_new:6:39: A literal can't be prefixed by 'new'.
final Map<String, Undefined> foo2 = new <String, List<int>>{};
^^^
-parser/error_recovery/issue_45251_new:9:39: Unexpected token 'new'.
+parser/error_recovery/issue_45251_new:9:39: A map literal can't be prefixed by 'new Map'.
final Map<String, Undefined> foo3 = new Map{};
- ^^^
+ ^^^^^^^
-parser/error_recovery/issue_45251_new:9:43: Unexpected token 'Map'.
- final Map<String, Undefined> foo3 = new Map{};
- ^^^
-
-parser/error_recovery/issue_45251_new:18:39: Unexpected token 'new'.
+parser/error_recovery/issue_45251_new:18:39: A map literal can't be prefixed by 'new Map'.
final Map<String, Undefined> foo6 = new Map<String, List<int>>{"a": null};
- ^^^
+ ^^^^^^^
-parser/error_recovery/issue_45251_new:18:43: Unexpected token 'Map'.
- final Map<String, Undefined> foo6 = new Map<String, List<int>>{"a": null};
- ^^^
-
-parser/error_recovery/issue_45251_new:21:39: Unexpected token 'new'.
+parser/error_recovery/issue_45251_new:21:39: A map literal can't be prefixed by 'new Map'.
final Map<String, Undefined> foo7 = new Map{"a": null};
- ^^^
+ ^^^^^^^
-parser/error_recovery/issue_45251_new:21:43: Unexpected token 'Map'.
- final Map<String, Undefined> foo7 = new Map{"a": null};
- ^^^
-
-parser/error_recovery/issue_45251_new:24:39: Unexpected token 'new'.
+parser/error_recovery/issue_45251_new:24:39: A literal can't be prefixed by 'new'.
final Map<String, Undefined> foo8 = new <String, List<int>>{"a": null};
^^^
-parser/error_recovery/issue_45251_new:27:39: Unexpected token 'new'.
+parser/error_recovery/issue_45251_new:27:39: A literal can't be prefixed by 'new'.
final Map<String, Undefined> foo9 = new {"a": null};
^^^
@@ -73,8 +57,7 @@
handleType(Map, null)
handleIdentifier(foo1, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ handleRecoverableError(Message[LiteralWithClassAndNew, A map literal can't be prefixed by 'new Map'., Try removing 'new' and 'Map', {string: map, lexeme: Map}], new, Map)
beginTypeArguments(<)
handleIdentifier(String, typeReference)
handleNoTypeArguments(,)
@@ -107,7 +90,7 @@
handleType(Map, null)
handleIdentifier(foo2, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ handleRecoverableError(LiteralWithNew, new, new)
beginTypeArguments(<)
handleIdentifier(String, typeReference)
handleNoTypeArguments(,)
@@ -140,8 +123,7 @@
handleType(Map, null)
handleIdentifier(foo3, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ handleRecoverableError(Message[LiteralWithClassAndNew, A map literal can't be prefixed by 'new Map'., Try removing 'new' and 'Map', {string: map, lexeme: Map}], new, Map)
handleNoTypeArguments({)
handleLiteralSetOrMap(0, {, null, }, false)
endFieldInitializer(=, ;)
@@ -230,8 +212,7 @@
handleType(Map, null)
handleIdentifier(foo6, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ handleRecoverableError(Message[LiteralWithClassAndNew, A map literal can't be prefixed by 'new Map'., Try removing 'new' and 'Map', {string: map, lexeme: Map}], new, Map)
beginTypeArguments(<)
handleIdentifier(String, typeReference)
handleNoTypeArguments(,)
@@ -268,8 +249,7 @@
handleType(Map, null)
handleIdentifier(foo7, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ handleRecoverableError(Message[LiteralWithClassAndNew, A map literal can't be prefixed by 'new Map'., Try removing 'new' and 'Map', {string: map, lexeme: Map}], new, Map)
handleNoTypeArguments({)
beginLiteralString("a")
endLiteralString(0, :)
@@ -295,7 +275,7 @@
handleType(Map, null)
handleIdentifier(foo8, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ handleRecoverableError(LiteralWithNew, new, new)
beginTypeArguments(<)
handleIdentifier(String, typeReference)
handleNoTypeArguments(,)
@@ -332,7 +312,7 @@
handleType(Map, null)
handleIdentifier(foo9, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ handleRecoverableError(LiteralWithNew, new, new)
handleNoTypeArguments({)
beginLiteralString("a")
endLiteralString(0, :)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_new.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_new.dart.intertwined.expect
index b4849db..d3039be 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_new.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_new.dart.intertwined.expect
@@ -54,10 +54,7 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- reportRecoverableErrorWithToken(Map, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ listener: handleRecoverableError(Message[LiteralWithClassAndNew, A map literal can't be prefixed by 'new Map'., Try removing 'new' and 'Map', {string: map, lexeme: Map}], new, Map)
parsePrimary(Map, expression)
parseLiteralListSetMapOrFunction(Map, null)
listener: beginTypeArguments(<)
@@ -105,8 +102,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ reportRecoverableError(new, LiteralWithNew)
+ listener: handleRecoverableError(LiteralWithNew, new, new)
parsePrimary(new, expression)
parseLiteralListSetMapOrFunction(new, null)
listener: beginTypeArguments(<)
@@ -154,10 +151,7 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- reportRecoverableErrorWithToken(Map, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ listener: handleRecoverableError(Message[LiteralWithClassAndNew, A map literal can't be prefixed by 'new Map'., Try removing 'new' and 'Map', {string: map, lexeme: Map}], new, Map)
parsePrimary(Map, expression)
listener: handleNoTypeArguments({)
parseLiteralSetOrMapSuffix(Map, null)
@@ -294,10 +288,7 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- reportRecoverableErrorWithToken(Map, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ listener: handleRecoverableError(Message[LiteralWithClassAndNew, A map literal can't be prefixed by 'new Map'., Try removing 'new' and 'Map', {string: map, lexeme: Map}], new, Map)
parsePrimary(Map, expression)
parseLiteralListSetMapOrFunction(Map, null)
listener: beginTypeArguments(<)
@@ -360,10 +351,7 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- reportRecoverableErrorWithToken(Map, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Map'., null, {lexeme: Map}], Map, Map)
+ listener: handleRecoverableError(Message[LiteralWithClassAndNew, A map literal can't be prefixed by 'new Map'., Try removing 'new' and 'Map', {string: map, lexeme: Map}], new, Map)
parsePrimary(Map, expression)
listener: handleNoTypeArguments({)
parseLiteralSetOrMapSuffix(Map, null)
@@ -414,8 +402,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ reportRecoverableError(new, LiteralWithNew)
+ listener: handleRecoverableError(LiteralWithNew, new, new)
parsePrimary(new, expression)
parseLiteralListSetMapOrFunction(new, null)
listener: beginTypeArguments(<)
@@ -478,8 +466,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ reportRecoverableError(new, LiteralWithNew)
+ listener: handleRecoverableError(LiteralWithNew, new, new)
parsePrimary(new, expression)
listener: handleNoTypeArguments({)
parseLiteralSetOrMapSuffix(new, null)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set.dart.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set.dart.expect
index d8f4e89..e1d57ca 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set.dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set.dart.expect
@@ -1,18 +1,18 @@
Problems reported:
-parser/error_recovery/issue_45251_set:3:31: Unexpected token 'Set'.
+parser/error_recovery/issue_45251_set:3:31: A set literal can't be prefixed by 'Set'.
final Set<Undefined> foo1 = Set<List<int>>{};
^^^
-parser/error_recovery/issue_45251_set:9:31: Unexpected token 'Set'.
+parser/error_recovery/issue_45251_set:9:31: A set literal can't be prefixed by 'Set'.
final Set<Undefined> foo3 = Set{};
^^^
-parser/error_recovery/issue_45251_set:18:31: Unexpected token 'Set'.
+parser/error_recovery/issue_45251_set:18:31: A set literal can't be prefixed by 'Set'.
final Set<Undefined> foo6 = Set<List<int>>{null};
^^^
-parser/error_recovery/issue_45251_set:21:31: Unexpected token 'Set'.
+parser/error_recovery/issue_45251_set:21:31: A set literal can't be prefixed by 'Set'.
final Set<Undefined> foo7 = Set{null};
^^^
@@ -42,7 +42,7 @@
handleType(Set, null)
handleIdentifier(foo1, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
beginTypeArguments(<)
@@ -95,7 +95,7 @@
handleType(Set, null)
handleIdentifier(foo3, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
handleNoTypeArguments({)
handleLiteralSetOrMap(0, {, null, }, false)
endFieldInitializer(=, ;)
@@ -164,7 +164,7 @@
handleType(Set, null)
handleIdentifier(foo6, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
beginTypeArguments(<)
@@ -192,7 +192,7 @@
handleType(Set, null)
handleIdentifier(foo7, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
handleNoTypeArguments({)
handleLiteralNull(null)
handleLiteralSetOrMap(1, {, null, }, true)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set.dart.intertwined.expect
index aa44787..9fad6f6 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set.dart.intertwined.expect
@@ -51,8 +51,8 @@
parsePrimary(=, expression)
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
- reportRecoverableErrorWithToken(Set, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ reportRecoverableError(Set, Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
parsePrimary(Set, expression)
parseLiteralListSetMapOrFunction(Set, null)
listener: beginTypeArguments(<)
@@ -132,8 +132,8 @@
parsePrimary(=, expression)
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
- reportRecoverableErrorWithToken(Set, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ reportRecoverableError(Set, Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
parsePrimary(Set, expression)
listener: handleNoTypeArguments({)
parseLiteralSetOrMapSuffix(Set, null)
@@ -250,8 +250,8 @@
parsePrimary(=, expression)
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
- reportRecoverableErrorWithToken(Set, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ reportRecoverableError(Set, Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
parsePrimary(Set, expression)
parseLiteralListSetMapOrFunction(Set, null)
listener: beginTypeArguments(<)
@@ -299,8 +299,8 @@
parsePrimary(=, expression)
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
- reportRecoverableErrorWithToken(Set, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ reportRecoverableError(Set, Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
parsePrimary(Set, expression)
listener: handleNoTypeArguments({)
parseLiteralSetOrMapSuffix(Set, null)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_const.dart.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_const.dart.expect
index 4d44965..7d01b7d5 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_const.dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_const.dart.expect
@@ -1,18 +1,18 @@
Problems reported:
-parser/error_recovery/issue_45251_set_const:3:37: Unexpected token 'Set'.
+parser/error_recovery/issue_45251_set_const:3:37: A set literal can't be prefixed by 'Set'.
final Set<Undefined> foo1 = const Set<List<int>>{};
^^^
-parser/error_recovery/issue_45251_set_const:9:37: Unexpected token 'Set'.
+parser/error_recovery/issue_45251_set_const:9:37: A set literal can't be prefixed by 'Set'.
final Set<Undefined> foo3 = const Set{};
^^^
-parser/error_recovery/issue_45251_set_const:18:37: Unexpected token 'Set'.
+parser/error_recovery/issue_45251_set_const:18:37: A set literal can't be prefixed by 'Set'.
final Set<Undefined> foo6 = const Set<List<int>>{null};
^^^
-parser/error_recovery/issue_45251_set_const:21:37: Unexpected token 'Set'.
+parser/error_recovery/issue_45251_set_const:21:37: A set literal can't be prefixed by 'Set'.
final Set<Undefined> foo7 = const Set{null};
^^^
@@ -42,7 +42,7 @@
handleType(Set, null)
handleIdentifier(foo1, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
beginConstLiteral(<)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
@@ -99,7 +99,7 @@
handleType(Set, null)
handleIdentifier(foo3, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
beginConstLiteral({)
handleNoTypeArguments({)
handleLiteralSetOrMap(0, {, const, }, false)
@@ -178,7 +178,7 @@
handleType(Set, null)
handleIdentifier(foo6, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
beginConstLiteral(<)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
@@ -208,7 +208,7 @@
handleType(Set, null)
handleIdentifier(foo7, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
beginConstLiteral({)
handleNoTypeArguments({)
handleLiteralNull(null)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_const.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_const.dart.intertwined.expect
index 8239dcb..7f9a6a5 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_const.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_const.dart.intertwined.expect
@@ -50,8 +50,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseConstExpression(=)
- reportRecoverableErrorWithToken(Set, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ reportRecoverableError(Set, Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
listener: beginConstLiteral(<)
parseLiteralListSetMapOrFunction(Set, const)
listener: beginTypeArguments(<)
@@ -134,8 +134,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseConstExpression(=)
- reportRecoverableErrorWithToken(Set, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ reportRecoverableError(Set, Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
listener: beginConstLiteral({)
listener: handleNoTypeArguments({)
parseLiteralSetOrMapSuffix(Set, const)
@@ -258,8 +258,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseConstExpression(=)
- reportRecoverableErrorWithToken(Set, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ reportRecoverableError(Set, Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
listener: beginConstLiteral(<)
parseLiteralListSetMapOrFunction(Set, const)
listener: beginTypeArguments(<)
@@ -307,8 +307,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseConstExpression(=)
- reportRecoverableErrorWithToken(Set, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ reportRecoverableError(Set, Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}])
+ listener: handleRecoverableError(Message[LiteralWithClass, A set literal can't be prefixed by 'Set'., Try removing 'Set', {string: set, lexeme: Set}], Set, Set)
listener: beginConstLiteral({)
listener: handleNoTypeArguments({)
parseLiteralSetOrMapSuffix(Set, const)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_new.dart.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_new.dart.expect
index aa57003..1df0d1b 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_new.dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_new.dart.expect
@@ -1,46 +1,30 @@
Problems reported:
-parser/error_recovery/issue_45251_set_new:3:31: Unexpected token 'new'.
+parser/error_recovery/issue_45251_set_new:3:31: A set literal can't be prefixed by 'new Set'.
final Set<Undefined> foo1 = new Set<List<int>>{};
- ^^^
+ ^^^^^^^
-parser/error_recovery/issue_45251_set_new:3:35: Unexpected token 'Set'.
- final Set<Undefined> foo1 = new Set<List<int>>{};
- ^^^
-
-parser/error_recovery/issue_45251_set_new:6:31: Unexpected token 'new'.
+parser/error_recovery/issue_45251_set_new:6:31: A literal can't be prefixed by 'new'.
final Set<Undefined> foo2 = new <List<int>>{};
^^^
-parser/error_recovery/issue_45251_set_new:9:31: Unexpected token 'new'.
+parser/error_recovery/issue_45251_set_new:9:31: A set literal can't be prefixed by 'new Set'.
final Set<Undefined> foo3 = new Set{};
- ^^^
+ ^^^^^^^
-parser/error_recovery/issue_45251_set_new:9:35: Unexpected token 'Set'.
- final Set<Undefined> foo3 = new Set{};
- ^^^
-
-parser/error_recovery/issue_45251_set_new:18:31: Unexpected token 'new'.
+parser/error_recovery/issue_45251_set_new:18:31: A set literal can't be prefixed by 'new Set'.
final Set<Undefined> foo6 = new Set<List<int>>{null};
- ^^^
+ ^^^^^^^
-parser/error_recovery/issue_45251_set_new:18:35: Unexpected token 'Set'.
- final Set<Undefined> foo6 = new Set<List<int>>{null};
- ^^^
-
-parser/error_recovery/issue_45251_set_new:21:31: Unexpected token 'new'.
+parser/error_recovery/issue_45251_set_new:21:31: A set literal can't be prefixed by 'new Set'.
final Set<Undefined> foo7 = new Set{null};
- ^^^
+ ^^^^^^^
-parser/error_recovery/issue_45251_set_new:21:35: Unexpected token 'Set'.
- final Set<Undefined> foo7 = new Set{null};
- ^^^
-
-parser/error_recovery/issue_45251_set_new:24:31: Unexpected token 'new'.
+parser/error_recovery/issue_45251_set_new:24:31: A literal can't be prefixed by 'new'.
final Set<Undefined> foo8 = new <List<int>>{null};
^^^
-parser/error_recovery/issue_45251_set_new:27:31: Unexpected token 'new'.
+parser/error_recovery/issue_45251_set_new:27:31: A literal can't be prefixed by 'new'.
final Set<Undefined> foo9 = new {null};
^^^
@@ -70,8 +54,7 @@
handleType(Set, null)
handleIdentifier(foo1, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ handleRecoverableError(Message[LiteralWithClassAndNew, A set literal can't be prefixed by 'new Set'., Try removing 'new' and 'Set', {string: set, lexeme: Set}], new, Set)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
beginTypeArguments(<)
@@ -98,7 +81,7 @@
handleType(Set, null)
handleIdentifier(foo2, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ handleRecoverableError(LiteralWithNew, new, new)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
beginTypeArguments(<)
@@ -125,8 +108,7 @@
handleType(Set, null)
handleIdentifier(foo3, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ handleRecoverableError(Message[LiteralWithClassAndNew, A set literal can't be prefixed by 'new Set'., Try removing 'new' and 'Set', {string: set, lexeme: Set}], new, Set)
handleNoTypeArguments({)
handleLiteralSetOrMap(0, {, null, }, false)
endFieldInitializer(=, ;)
@@ -203,8 +185,7 @@
handleType(Set, null)
handleIdentifier(foo6, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ handleRecoverableError(Message[LiteralWithClassAndNew, A set literal can't be prefixed by 'new Set'., Try removing 'new' and 'Set', {string: set, lexeme: Set}], new, Set)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
beginTypeArguments(<)
@@ -232,8 +213,7 @@
handleType(Set, null)
handleIdentifier(foo7, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ handleRecoverableError(Message[LiteralWithClassAndNew, A set literal can't be prefixed by 'new Set'., Try removing 'new' and 'Set', {string: set, lexeme: Set}], new, Set)
handleNoTypeArguments({)
handleLiteralNull(null)
handleLiteralSetOrMap(1, {, null, }, true)
@@ -253,7 +233,7 @@
handleType(Set, null)
handleIdentifier(foo8, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ handleRecoverableError(LiteralWithNew, new, new)
beginTypeArguments(<)
handleIdentifier(List, typeReference)
beginTypeArguments(<)
@@ -281,7 +261,7 @@
handleType(Set, null)
handleIdentifier(foo9, fieldDeclaration)
beginFieldInitializer(=)
- handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ handleRecoverableError(LiteralWithNew, new, new)
handleNoTypeArguments({)
handleLiteralNull(null)
handleLiteralSetOrMap(1, {, null, }, true)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_new.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_new.dart.intertwined.expect
index 2eb284f..49f1043 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_new.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_new.dart.intertwined.expect
@@ -50,10 +50,7 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- reportRecoverableErrorWithToken(Set, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ listener: handleRecoverableError(Message[LiteralWithClassAndNew, A set literal can't be prefixed by 'new Set'., Try removing 'new' and 'Set', {string: set, lexeme: Set}], new, Set)
parsePrimary(Set, expression)
parseLiteralListSetMapOrFunction(Set, null)
listener: beginTypeArguments(<)
@@ -94,8 +91,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ reportRecoverableError(new, LiteralWithNew)
+ listener: handleRecoverableError(LiteralWithNew, new, new)
parsePrimary(new, expression)
parseLiteralListSetMapOrFunction(new, null)
listener: beginTypeArguments(<)
@@ -136,10 +133,7 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- reportRecoverableErrorWithToken(Set, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ listener: handleRecoverableError(Message[LiteralWithClassAndNew, A set literal can't be prefixed by 'new Set'., Try removing 'new' and 'Set', {string: set, lexeme: Set}], new, Set)
parsePrimary(Set, expression)
listener: handleNoTypeArguments({)
parseLiteralSetOrMapSuffix(Set, null)
@@ -261,10 +255,7 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- reportRecoverableErrorWithToken(Set, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ listener: handleRecoverableError(Message[LiteralWithClassAndNew, A set literal can't be prefixed by 'new Set'., Try removing 'new' and 'Set', {string: set, lexeme: Set}], new, Set)
parsePrimary(Set, expression)
parseLiteralListSetMapOrFunction(Set, null)
listener: beginTypeArguments(<)
@@ -311,10 +302,7 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
- reportRecoverableErrorWithToken(Set, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'Set'., null, {lexeme: Set}], Set, Set)
+ listener: handleRecoverableError(Message[LiteralWithClassAndNew, A set literal can't be prefixed by 'new Set'., Try removing 'new' and 'Set', {string: set, lexeme: Set}], new, Set)
parsePrimary(Set, expression)
listener: handleNoTypeArguments({)
parseLiteralSetOrMapSuffix(Set, null)
@@ -352,8 +340,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ reportRecoverableError(new, LiteralWithNew)
+ listener: handleRecoverableError(LiteralWithNew, new, new)
parsePrimary(new, expression)
parseLiteralListSetMapOrFunction(new, null)
listener: beginTypeArguments(<)
@@ -400,8 +388,8 @@
parseUnaryExpression(=, true)
parsePrimary(=, expression)
parseNewExpression(=)
- reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'new'., null, {lexeme: new}], new, new)
+ reportRecoverableError(new, LiteralWithNew)
+ listener: handleRecoverableError(LiteralWithNew, new, new)
parsePrimary(new, expression)
listener: handleNoTypeArguments({)
parseLiteralSetOrMapSuffix(new, null)
diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart
index e4b76d3..bdc0a87 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -724,16 +724,35 @@
@override
Set<Expectation> processExpectedOutcomes(
Set<Expectation> outcomes, TestDescription description) {
- if (skipVm && outcomes.length == 1 && outcomes.single == runtimeError) {
- return new Set<Expectation>.from([Expectation.Pass]);
- } else if (!semiFuzz &&
- outcomes.length == 1 &&
- (outcomes.single == semiFuzzFailure ||
- outcomes.single == semiFuzzCrash)) {
- return new Set<Expectation>.from([Expectation.Pass]);
- } else {
- return outcomes;
+ // Remove outcomes related to phases not currently in effect.
+
+ Set<Expectation> result;
+
+ // If skipping VM we can't get a runtime error.
+ if (skipVm && outcomes.contains(runtimeError)) {
+ result ??= new Set.from(outcomes);
+ result.remove(runtimeError);
}
+
+ // If not semi-fuzzing we can't get semi-fuzz errors.
+ if (!semiFuzz &&
+ (outcomes.contains(semiFuzzFailure) ||
+ outcomes.contains(semiFuzzCrash))) {
+ result ??= new Set.from(outcomes);
+ result.remove(semiFuzzFailure);
+ result.remove(semiFuzzCrash);
+ }
+
+ // Fast-path: no changes made.
+ if (result == null) return outcomes;
+
+ // Changes made: No expectations left. This happens when all expected
+ // outcomes are removed above.
+ // We have to put in the implicit assumption that it will pass then.
+ if (result.isEmpty) return {Expectation.Pass};
+
+ // Changes made with at least one expectation left. That's out result!
+ return result;
}
static Future<FastaContext> create(
diff --git a/pkg/front_end/testcases/regress/issue_31155.dart.weak.expect b/pkg/front_end/testcases/regress/issue_31155.dart.weak.expect
index 0acdfa9..2f83d69 100644
--- a/pkg/front_end/testcases/regress/issue_31155.dart.weak.expect
+++ b/pkg/front_end/testcases/regress/issue_31155.dart.weak.expect
@@ -2,7 +2,8 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/regress/issue_31155.dart:11:11: Error: Unexpected token 'Map'.
+// pkg/front_end/testcases/regress/issue_31155.dart:11:11: Error: A map literal can't be prefixed by 'Map'.
+// Try removing 'Map'
// var f = Map<A, B> {};
// ^^^
//
diff --git a/pkg/front_end/testcases/regress/issue_31155.dart.weak.outline.expect b/pkg/front_end/testcases/regress/issue_31155.dart.weak.outline.expect
index 45d6de2..2a3e5ef 100644
--- a/pkg/front_end/testcases/regress/issue_31155.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/regress/issue_31155.dart.weak.outline.expect
@@ -2,7 +2,8 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/regress/issue_31155.dart:11:11: Error: Unexpected token 'Map'.
+// pkg/front_end/testcases/regress/issue_31155.dart:11:11: Error: A map literal can't be prefixed by 'Map'.
+// Try removing 'Map'
// var f = Map<A, B> {};
// ^^^
//
diff --git a/pkg/front_end/testcases/regress/issue_31155.dart.weak.transformed.expect b/pkg/front_end/testcases/regress/issue_31155.dart.weak.transformed.expect
index 0acdfa9..2f83d69 100644
--- a/pkg/front_end/testcases/regress/issue_31155.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_31155.dart.weak.transformed.expect
@@ -2,7 +2,8 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/regress/issue_31155.dart:11:11: Error: Unexpected token 'Map'.
+// pkg/front_end/testcases/regress/issue_31155.dart:11:11: Error: A map literal can't be prefixed by 'Map'.
+// Try removing 'Map'
// var f = Map<A, B> {};
// ^^^
//
diff --git a/tests/language/list/literal5_test.dart b/tests/language/list/literal5_test.dart
index 5226bb7..ea27f04 100644
--- a/tests/language/list/literal5_test.dart
+++ b/tests/language/list/literal5_test.dart
@@ -6,10 +6,7 @@
main() {
new List<int>[1, 2];
-//^^^
-// [analyzer] SYNTACTIC_ERROR.UNEXPECTED_TOKEN
-// [cfe] Unexpected token 'new'.
- // ^^^^
- // [analyzer] SYNTACTIC_ERROR.UNEXPECTED_TOKEN
- // [cfe] Unexpected token 'List'.
+//^^^^^^^^
+// [analyzer] SYNTACTIC_ERROR.LITERAL_WITH_CLASS_AND_NEW
+// [cfe] A list literal can't be prefixed by 'new List'.
}
diff --git a/tests/language/map/literal13_test.dart b/tests/language/map/literal13_test.dart
index 5ebbbc9..1ab622b2 100644
--- a/tests/language/map/literal13_test.dart
+++ b/tests/language/map/literal13_test.dart
@@ -6,12 +6,9 @@
main() {
var map = new Map<int>{ "a": 1, "b": 2, "c": 3 };
- // ^^^
- // [analyzer] SYNTACTIC_ERROR.UNEXPECTED_TOKEN
- // [cfe] Unexpected token 'new'.
- // ^^^
- // [analyzer] SYNTACTIC_ERROR.UNEXPECTED_TOKEN
- // [cfe] Unexpected token 'Map'.
+ // ^^^^^^^
+ // [analyzer] SYNTACTIC_ERROR.LITERAL_WITH_CLASS_AND_NEW
+ // [cfe] A map literal can't be prefixed by 'new Map'.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.MAP_ENTRY_NOT_IN_MAP
// ^
diff --git a/tests/language_2/list/literal5_test.dart b/tests/language_2/list/literal5_test.dart
index 5226bb7..ea27f04 100644
--- a/tests/language_2/list/literal5_test.dart
+++ b/tests/language_2/list/literal5_test.dart
@@ -6,10 +6,7 @@
main() {
new List<int>[1, 2];
-//^^^
-// [analyzer] SYNTACTIC_ERROR.UNEXPECTED_TOKEN
-// [cfe] Unexpected token 'new'.
- // ^^^^
- // [analyzer] SYNTACTIC_ERROR.UNEXPECTED_TOKEN
- // [cfe] Unexpected token 'List'.
+//^^^^^^^^
+// [analyzer] SYNTACTIC_ERROR.LITERAL_WITH_CLASS_AND_NEW
+// [cfe] A list literal can't be prefixed by 'new List'.
}
diff --git a/tests/language_2/map/literal13_test.dart b/tests/language_2/map/literal13_test.dart
index 5ebbbc9..1ab622b2 100644
--- a/tests/language_2/map/literal13_test.dart
+++ b/tests/language_2/map/literal13_test.dart
@@ -6,12 +6,9 @@
main() {
var map = new Map<int>{ "a": 1, "b": 2, "c": 3 };
- // ^^^
- // [analyzer] SYNTACTIC_ERROR.UNEXPECTED_TOKEN
- // [cfe] Unexpected token 'new'.
- // ^^^
- // [analyzer] SYNTACTIC_ERROR.UNEXPECTED_TOKEN
- // [cfe] Unexpected token 'Map'.
+ // ^^^^^^^
+ // [analyzer] SYNTACTIC_ERROR.LITERAL_WITH_CLASS_AND_NEW
+ // [cfe] A map literal can't be prefixed by 'new Map'.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.MAP_ENTRY_NOT_IN_MAP
// ^
diff --git a/tools/VERSION b/tools/VERSION
index 1c0b0fd..ff5f7a0 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 13
PATCH 0
-PRERELEASE 166
+PRERELEASE 167
PRERELEASE_PATCH 0
\ No newline at end of file