[parser] More specific error messages when recovering new/const/Map/Set/List with said literals

Follow-up to https://dart-review.googlesource.com/c/sdk/+/190022

Change-Id: Id42336216267dcbf481ae6e111177e6296ea6779
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This commit is contained in:
Jens Johansen 2021-03-25 13:27:03 +00:00 committed by commit-bot@chromium.org
parent 6fff4de306
commit ac9b4aab8d
32 changed files with 373 additions and 327 deletions

View file

@ -6307,6 +6307,65 @@ const MessageCode messageListLiteralTooManyTypeArguments = const MessageCode(
analyzerCodes: <String>["EXPECTED_ONE_LIST_TYPE_ARGUMENTS"],
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;

View file

@ -2412,13 +2412,7 @@ class Parser {
/// 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 @@ class Parser {
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 @@ class Parser {
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 @@ class Parser {
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 @@ class Parser {
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 @@ class Parser {
}
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 @@ class Parser {
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 @@ class Parser {
}
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 @@ class Parser {
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 @@ class Parser {
// 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);
}
}

View file

@ -734,6 +734,9 @@ const List<ErrorCode> errorCodeValues = [
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,

View file

@ -555,6 +555,13 @@ class ParserErrorCode extends ErrorCode {
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.",

View file

@ -122,6 +122,9 @@ final fastaAnalyzerErrorCodes = <ErrorCode?>[
_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 @@ const ParserErrorCode _LIBRARY_DIRECTIVE_NOT_FIRST = ParserErrorCode(
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.",

View file

@ -1034,7 +1034,13 @@ class C<K extends L<T {
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,
]);
}

View file

@ -1248,6 +1248,54 @@ UnexpectedToken:
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

View file

@ -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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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, :)

View file

@ -55,8 +55,8 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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)

View file

@ -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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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")

View file

@ -54,8 +54,8 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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)

View file

@ -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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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(<)

View file

@ -51,8 +51,8 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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(<)

View file

@ -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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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)

View file

@ -50,8 +50,8 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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)

View file

@ -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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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, ])

View file

@ -50,10 +50,7 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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)

View file

@ -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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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, :)

View file

@ -54,10 +54,7 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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)

View file

@ -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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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)

View file

@ -51,8 +51,8 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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)

View file

@ -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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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)

View file

@ -50,8 +50,8 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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)

View file

@ -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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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 @@ beginCompilationUnit(class)
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)

View file

@ -50,10 +50,7 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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 @@ parseUnit(class)
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)

View file

@ -2,7 +2,8 @@ library;
//
// 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> {};
// ^^^
//

View file

@ -2,7 +2,8 @@ library;
//
// 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> {};
// ^^^
//

View file

@ -2,7 +2,8 @@ library;
//
// 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> {};
// ^^^
//

View file

@ -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'.
}

View file

@ -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
// ^

View file

@ -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'.
}

View file

@ -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
// ^