Version 2.15.0-59.0.dev
Merge commit '72de10d9381304d8a9ec68a4d1f2f0d474d29c87' into 'dev'
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 26c8242..d31cf68 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
@@ -3889,6 +3889,18 @@
identical(operator.kind, BANG_EQ_EQ_TOKEN) ||
isUnaryMinus(operator)) {
isOperator = true;
+ if (optional(">>", operator) &&
+ optional(">", operator.next!) &&
+ operator.charEnd == operator.next!.charOffset) {
+ // Special case use of triple-shift in cases where it isn't enabled.
+ reportRecoverableErrorWithEnd(
+ operator,
+ operator.next!,
+ codes.templateExperimentNotEnabled
+ .withArguments("triple-shift", "2.14"));
+ operator = rewriter.replaceNextTokensWithSyntheticToken(
+ name, 2, TokenType.GT_GT_GT);
+ }
}
}
@@ -5012,6 +5024,29 @@
lastBinaryExpressionLevel = level;
}
}
+ if (optional(">>", next) && next.charEnd == next.next!.charOffset) {
+ if (optional(">", next.next!)) {
+ // Special case use of triple-shift in cases where it isn't
+ // enabled.
+ reportRecoverableErrorWithEnd(
+ next,
+ next.next!,
+ codes.templateExperimentNotEnabled
+ .withArguments("triple-shift", "2.14"));
+ next = rewriter.replaceNextTokensWithSyntheticToken(
+ token, 2, TokenType.GT_GT_GT);
+ } else if (optional(">=", next.next!)) {
+ // Special case use of triple-shift in cases where it isn't
+ // enabled.
+ reportRecoverableErrorWithEnd(
+ next,
+ next.next!,
+ codes.templateExperimentNotEnabled
+ .withArguments("triple-shift", "2.14"));
+ next = rewriter.replaceNextTokensWithSyntheticToken(
+ token, 2, TokenType.GT_GT_GT_EQ);
+ }
+ }
listener.beginBinaryExpression(next);
// Left associative, so we recurse at the next higher
// precedence level.
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/token_stream_rewriter.dart b/pkg/_fe_analyzer_shared/lib/src/parser/token_stream_rewriter.dart
index e033fca..7d9c087 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/token_stream_rewriter.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/token_stream_rewriter.dart
@@ -162,6 +162,34 @@
return replacement;
}
+ /// Insert a new simple synthetic token of [newTokenType] after
+ /// [previousToken] instead of the [count] tokens actually coming after it and
+ /// return the new token.
+ /// The first old token will be linked from the new one (and the next ones can
+ /// be found via the next pointer chain on it) though, so it's not totally
+ /// gone.
+ ReplacementToken replaceNextTokensWithSyntheticToken(
+ Token previousToken, int count, TokenType newTokenType) {
+ assert(newTokenType is! Keyword,
+ 'use an unwritten variation of insertSyntheticKeyword instead');
+
+ // [token] <--> [a_1] <--> ... <--> [a_n] <--> [b]
+ ReplacementToken replacement =
+ new ReplacementToken(newTokenType, previousToken.next!);
+ insertToken(previousToken, replacement);
+ // [token] <--> [replacement] <--> [a_1] <--> ... <--> [a_n] <--> [b]
+
+ Token end = replacement.next!;
+ while (count > 0) {
+ count--;
+ end = end.next!;
+ }
+ _setNext(replacement, end);
+ // [token] <--> [replacement] <--> [b]
+
+ return replacement;
+ }
+
/// Insert a synthetic identifier after [token] and return the new identifier.
Token insertSyntheticIdentifier(Token token, [String value = '']) {
return insertToken(
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart b/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart
new file mode 100644
index 0000000..a0c220e
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart
@@ -0,0 +1,13 @@
+class Foo {
+ Foo operator >>>(_) => this;
+}
+
+main() {
+ Foo foo = new Foo();
+ foo >>> 42;
+ print(foo >>> 42);
+ print(foo >>>= 42);
+ if ((foo >>>= 42) == foo) {
+ print("same");
+ }
+}
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.expect b/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.expect
new file mode 100644
index 0000000..3854dcc
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.expect
@@ -0,0 +1,166 @@
+Problems reported:
+
+parser/no-triple-shift/define_triple_shift_method:2:16: This requires the 'triple-shift' language feature to be enabled.
+ Foo operator >>>(_) => this;
+ ^^^
+
+parser/no-triple-shift/define_triple_shift_method:7:7: This requires the 'triple-shift' language feature to be enabled.
+ foo >>> 42;
+ ^^^
+
+parser/no-triple-shift/define_triple_shift_method:8:13: This requires the 'triple-shift' language feature to be enabled.
+ print(foo >>> 42);
+ ^^^
+
+parser/no-triple-shift/define_triple_shift_method:9:13: This requires the 'triple-shift' language feature to be enabled.
+ print(foo >>>= 42);
+ ^^^^
+
+parser/no-triple-shift/define_triple_shift_method:10:12: This requires the 'triple-shift' language feature to be enabled.
+ if ((foo >>>= 42) == foo) {
+ ^^^^
+
+beginCompilationUnit(class)
+ beginMetadataStar(class)
+ endMetadataStar(0)
+ beginClassOrNamedMixinApplicationPrelude(class)
+ handleIdentifier(Foo, classOrMixinDeclaration)
+ handleNoTypeVariables({)
+ beginClassDeclaration(class, null, Foo)
+ handleNoType(Foo)
+ handleClassExtends(null, 1)
+ handleClassNoWithClause()
+ handleClassOrMixinImplements(null, 0)
+ handleClassHeader(class, class, null)
+ beginClassOrMixinBody(DeclarationKind.Class, {)
+ beginMetadataStar(Foo)
+ endMetadataStar(0)
+ beginMember()
+ handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >)
+ beginMethod(null, null, null, null, null, operator)
+ handleIdentifier(Foo, typeReference)
+ handleNoTypeArguments(operator)
+ handleType(Foo, null)
+ handleOperatorName(operator, >>>)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.NonStaticMethod)
+ beginMetadataStar(_)
+ endMetadataStar(0)
+ beginFormalParameter(_, MemberKind.NonStaticMethod, null, null, null)
+ handleNoType(()
+ handleIdentifier(_, formalParameterDeclaration)
+ handleFormalParameterWithoutValue())
+ endFormalParameter(null, null, _, null, null, FormalParameterKind.mandatory, MemberKind.NonStaticMethod)
+ endFormalParameters(1, (, ), MemberKind.NonStaticMethod)
+ handleNoInitializers()
+ handleAsyncModifier(null, null)
+ handleThisExpression(this, expression)
+ handleExpressionFunctionBody(=>, ;)
+ endClassMethod(null, Foo, (, null, ;)
+ endMember()
+ endClassOrMixinBody(DeclarationKind.Class, 1, {, })
+ endClassDeclaration(class, })
+ endTopLevelDeclaration(main)
+ beginMetadataStar(main)
+ endMetadataStar(0)
+ beginTopLevelMember(main)
+ beginTopLevelMethod(}, null)
+ handleNoType(})
+ handleIdentifier(main, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(Foo)
+ endMetadataStar(0)
+ handleIdentifier(Foo, typeReference)
+ handleNoTypeArguments(foo)
+ handleType(Foo, null)
+ beginVariablesDeclaration(foo, null, null)
+ handleIdentifier(foo, localVariableDeclaration)
+ beginInitializedIdentifier(foo)
+ beginVariableInitializer(=)
+ beginNewExpression(new)
+ handleIdentifier(Foo, constructorReference)
+ beginConstructorReference(Foo)
+ handleNoTypeArguments(()
+ handleNoConstructorReferenceContinuationAfterTypeArguments(()
+ endConstructorReference(Foo, null, ()
+ beginArguments(()
+ endArguments(0, (, ))
+ endNewExpression(new)
+ endVariableInitializer(=)
+ endInitializedIdentifier(foo)
+ endVariablesDeclaration(1, ;)
+ handleIdentifier(foo, expression)
+ handleNoTypeArguments(>>)
+ handleNoArguments(>>)
+ handleSend(foo, >>)
+ handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >)
+ beginBinaryExpression(>>>)
+ handleLiteralInt(42)
+ endBinaryExpression(>>)
+ handleExpressionStatement(;)
+ handleIdentifier(print, expression)
+ handleNoTypeArguments(()
+ beginArguments(()
+ handleIdentifier(foo, expression)
+ handleNoTypeArguments(>>)
+ handleNoArguments(>>)
+ handleSend(foo, >>)
+ handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >)
+ beginBinaryExpression(>>>)
+ handleLiteralInt(42)
+ endBinaryExpression(>>)
+ endArguments(1, (, ))
+ handleSend(print, ;)
+ handleExpressionStatement(;)
+ handleIdentifier(print, expression)
+ handleNoTypeArguments(()
+ beginArguments(()
+ handleIdentifier(foo, expression)
+ handleNoTypeArguments(>>)
+ handleNoArguments(>>)
+ handleSend(foo, >>)
+ handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >=)
+ beginBinaryExpression(>>>=)
+ handleLiteralInt(42)
+ endBinaryExpression(>>)
+ endArguments(1, (, ))
+ handleSend(print, ;)
+ handleExpressionStatement(;)
+ beginIfStatement(if)
+ handleIdentifier(foo, expression)
+ handleNoTypeArguments(>>)
+ handleNoArguments(>>)
+ handleSend(foo, >>)
+ handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >=)
+ beginBinaryExpression(>>>=)
+ handleLiteralInt(42)
+ endBinaryExpression(>>)
+ handleParenthesizedExpression(()
+ beginBinaryExpression(==)
+ handleIdentifier(foo, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(foo, ))
+ endBinaryExpression(==)
+ handleParenthesizedCondition(()
+ beginThenStatement({)
+ beginBlock({, BlockKind(statement))
+ handleIdentifier(print, expression)
+ handleNoTypeArguments(()
+ beginArguments(()
+ beginLiteralString("same")
+ endLiteralString(0, ))
+ endArguments(1, (, ))
+ handleSend(print, ;)
+ handleExpressionStatement(;)
+ endBlock(1, {, }, BlockKind(statement))
+ endThenStatement(})
+ endIfStatement(if, null)
+ endBlockFunctionBody(5, {, })
+ endTopLevelMethod(main, null, })
+ endTopLevelDeclaration()
+endCompilationUnit(2, )
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.intertwined.expect b/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.intertwined.expect
new file mode 100644
index 0000000..158a83e
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.intertwined.expect
@@ -0,0 +1,382 @@
+parseUnit(class)
+ skipErrorTokens(class)
+ listener: beginCompilationUnit(class)
+ syntheticPreviousToken(class)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(class)
+ listener: endMetadataStar(0)
+ parseTopLevelKeywordDeclaration(, class, Instance of 'DirectiveContext')
+ parseClassDeclarationModifiers(, class)
+ parseClassOrNamedMixinApplication(null, class)
+ listener: beginClassOrNamedMixinApplicationPrelude(class)
+ ensureIdentifier(class, classOrMixinDeclaration)
+ listener: handleIdentifier(Foo, classOrMixinDeclaration)
+ listener: handleNoTypeVariables({)
+ listener: beginClassDeclaration(class, null, Foo)
+ parseClass(Foo, class, class, Foo)
+ parseClassHeaderOpt(Foo, class, class)
+ parseClassExtendsOpt(Foo)
+ listener: handleNoType(Foo)
+ listener: handleClassExtends(null, 1)
+ parseWithClauseOpt(Foo)
+ listener: handleClassNoWithClause()
+ parseClassOrMixinImplementsOpt(Foo)
+ listener: handleClassOrMixinImplements(null, 0)
+ listener: handleClassHeader(class, class, null)
+ parseClassOrMixinOrExtensionBody(Foo, DeclarationKind.Class, Foo)
+ listener: beginClassOrMixinBody(DeclarationKind.Class, {)
+ notEofOrValue(}, Foo)
+ parseClassOrMixinOrExtensionMemberImpl({, DeclarationKind.Class, Foo)
+ parseMetadataStar({)
+ listener: beginMetadataStar(Foo)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ parseMethod({, null, null, null, null, null, null, {, Instance of 'SimpleType', null, operator, DeclarationKind.Class, Foo, false)
+ reportRecoverableErrorWithEnd(>>, >, Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}])
+ listener: handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >)
+ rewriter()
+ listener: beginMethod(null, null, null, null, null, operator)
+ listener: handleIdentifier(Foo, typeReference)
+ listener: handleNoTypeArguments(operator)
+ listener: handleType(Foo, null)
+ parseOperatorName(Foo)
+ listener: handleOperatorName(operator, >>>)
+ parseMethodTypeVar(>>>)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(>>>, operator, false, MemberKind.NonStaticMethod)
+ parseFormalParameters(>>>, MemberKind.NonStaticMethod)
+ parseFormalParametersRest((, MemberKind.NonStaticMethod)
+ listener: beginFormalParameters((, MemberKind.NonStaticMethod)
+ parseFormalParameter((, FormalParameterKind.mandatory, MemberKind.NonStaticMethod)
+ parseMetadataStar(()
+ listener: beginMetadataStar(_)
+ listener: endMetadataStar(0)
+ listener: beginFormalParameter(_, MemberKind.NonStaticMethod, null, null, null)
+ listener: handleNoType(()
+ ensureIdentifier((, formalParameterDeclaration)
+ listener: handleIdentifier(_, formalParameterDeclaration)
+ listener: handleFormalParameterWithoutValue())
+ listener: endFormalParameter(null, null, _, null, null, FormalParameterKind.mandatory, MemberKind.NonStaticMethod)
+ listener: endFormalParameters(1, (, ), MemberKind.NonStaticMethod)
+ parseInitializersOpt())
+ listener: handleNoInitializers()
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(), false, true)
+ parseExpressionFunctionBody(=>, false)
+ parseExpression(=>)
+ parsePrecedenceExpression(=>, 1, true)
+ parseUnaryExpression(=>, true)
+ parsePrimary(=>, expression)
+ parseThisExpression(=>, expression)
+ listener: handleThisExpression(this, expression)
+ ensureSemicolon(this)
+ listener: handleExpressionFunctionBody(=>, ;)
+ inGenerator()
+ listener: endClassMethod(null, Foo, (, null, ;)
+ listener: endMember()
+ notEofOrValue(}, })
+ listener: endClassOrMixinBody(DeclarationKind.Class, 1, {, })
+ listener: endClassDeclaration(class, })
+ listener: endTopLevelDeclaration(main)
+ parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+ parseMetadataStar(})
+ listener: beginMetadataStar(main)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(})
+ listener: beginTopLevelMember(main)
+ isReservedKeyword(()
+ parseTopLevelMethod(}, null, }, Instance of 'NoType', null, main, false)
+ listener: beginTopLevelMethod(}, null)
+ listener: handleNoType(})
+ ensureIdentifierPotentiallyRecovered(}, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(main, topLevelFunctionDeclaration)
+ parseMethodTypeVar(main)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(main, main, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(main, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, Foo)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false)
+ looksLikeLocalFunction(foo)
+ listener: beginMetadataStar(Foo)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(Foo, typeReference)
+ listener: handleNoTypeArguments(foo)
+ listener: handleType(Foo, null)
+ listener: beginVariablesDeclaration(foo, null, null)
+ parseVariablesDeclarationRest(Foo, true)
+ parseOptionallyInitializedIdentifier(Foo)
+ ensureIdentifier(Foo, localVariableDeclaration)
+ listener: handleIdentifier(foo, localVariableDeclaration)
+ listener: beginInitializedIdentifier(foo)
+ parseVariableInitializerOpt(foo)
+ listener: beginVariableInitializer(=)
+ parseExpression(=)
+ parsePrecedenceExpression(=, 1, true)
+ parseUnaryExpression(=, true)
+ parsePrimary(=, expression)
+ parseNewExpression(=)
+ isNextIdentifier(new)
+ listener: beginNewExpression(new)
+ parseConstructorReference(new, null)
+ ensureIdentifier(new, constructorReference)
+ listener: handleIdentifier(Foo, constructorReference)
+ listener: beginConstructorReference(Foo)
+ parseQualifiedRestOpt(Foo, constructorReferenceContinuation)
+ listener: handleNoTypeArguments(()
+ listener: handleNoConstructorReferenceContinuationAfterTypeArguments(()
+ listener: endConstructorReference(Foo, null, ()
+ parseConstructorInvocationArguments(Foo)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ listener: endArguments(0, (, ))
+ listener: endNewExpression(new)
+ listener: endVariableInitializer(=)
+ listener: endInitializedIdentifier(foo)
+ ensureSemicolon())
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, foo)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(foo)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(foo, expression)
+ listener: handleNoTypeArguments(>>)
+ parseArgumentsOpt(foo)
+ listener: handleNoArguments(>>)
+ listener: handleSend(foo, >>)
+ reportRecoverableErrorWithEnd(>>, >, Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}])
+ listener: handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >)
+ rewriter()
+ listener: beginBinaryExpression(>>>)
+ parsePrecedenceExpression(>>>, 13, true)
+ parseUnaryExpression(>>>, true)
+ parsePrimary(>>>, expression)
+ parseLiteralInt(>>>)
+ listener: handleLiteralInt(42)
+ listener: endBinaryExpression(>>)
+ ensureSemicolon(42)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, print)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(print)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ looksLikeFunctionBody(;)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(print, expression)
+ listener: handleNoTypeArguments(()
+ parseArgumentsOpt(print)
+ parseArguments(print)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ isNextIdentifier(()
+ ensureIdentifier((, expression)
+ listener: handleIdentifier(foo, expression)
+ listener: handleNoTypeArguments(>>)
+ parseArgumentsOpt(foo)
+ listener: handleNoArguments(>>)
+ listener: handleSend(foo, >>)
+ reportRecoverableErrorWithEnd(>>, >, Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}])
+ listener: handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >)
+ rewriter()
+ listener: beginBinaryExpression(>>>)
+ parsePrecedenceExpression(>>>, 13, true)
+ parseUnaryExpression(>>>, true)
+ parsePrimary(>>>, expression)
+ parseLiteralInt(>>>)
+ listener: handleLiteralInt(42)
+ listener: endBinaryExpression(>>)
+ listener: endArguments(1, (, ))
+ listener: handleSend(print, ;)
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, print)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(print)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ looksLikeFunctionBody(;)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(print, expression)
+ listener: handleNoTypeArguments(()
+ parseArgumentsOpt(print)
+ parseArguments(print)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ isNextIdentifier(()
+ ensureIdentifier((, expression)
+ listener: handleIdentifier(foo, expression)
+ listener: handleNoTypeArguments(>>)
+ parseArgumentsOpt(foo)
+ listener: handleNoArguments(>>)
+ listener: handleSend(foo, >>)
+ reportRecoverableErrorWithEnd(>>, >=, Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}])
+ listener: handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >=)
+ rewriter()
+ listener: beginBinaryExpression(>>>=)
+ parsePrecedenceExpression(>>>=, 13, true)
+ parseUnaryExpression(>>>=, true)
+ parsePrimary(>>>=, expression)
+ parseLiteralInt(>>>=)
+ listener: handleLiteralInt(42)
+ listener: endBinaryExpression(>>)
+ listener: endArguments(1, (, ))
+ listener: handleSend(print, ;)
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, if)
+ parseStatement(;)
+ parseStatementX(;)
+ parseIfStatement(;)
+ listener: beginIfStatement(if)
+ ensureParenthesizedCondition(if)
+ parseExpressionInParenthesisRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseParenthesizedExpressionOrFunctionLiteral(()
+ parseParenthesizedExpression(()
+ parseExpressionInParenthesis(()
+ parseExpressionInParenthesisRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ isNextIdentifier(()
+ ensureIdentifier((, expression)
+ listener: handleIdentifier(foo, expression)
+ listener: handleNoTypeArguments(>>)
+ parseArgumentsOpt(foo)
+ listener: handleNoArguments(>>)
+ listener: handleSend(foo, >>)
+ reportRecoverableErrorWithEnd(>>, >=, Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}])
+ listener: handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >=)
+ rewriter()
+ listener: beginBinaryExpression(>>>=)
+ parsePrecedenceExpression(>>>=, 13, true)
+ parseUnaryExpression(>>>=, true)
+ parsePrimary(>>>=, expression)
+ parseLiteralInt(>>>=)
+ listener: handleLiteralInt(42)
+ listener: endBinaryExpression(>>)
+ ensureCloseParen(42, ()
+ listener: handleParenthesizedExpression(()
+ listener: beginBinaryExpression(==)
+ parsePrecedenceExpression(==, 8, true)
+ parseUnaryExpression(==, true)
+ parsePrimary(==, expression)
+ parseSendOrFunctionLiteral(==, expression)
+ parseSend(==, expression)
+ isNextIdentifier(==)
+ ensureIdentifier(==, expression)
+ listener: handleIdentifier(foo, expression)
+ listener: handleNoTypeArguments())
+ parseArgumentsOpt(foo)
+ listener: handleNoArguments())
+ listener: handleSend(foo, ))
+ listener: endBinaryExpression(==)
+ ensureCloseParen(foo, ()
+ listener: handleParenthesizedCondition(()
+ listener: beginThenStatement({)
+ parseStatement())
+ parseStatementX())
+ parseBlock(), BlockKind(statement))
+ ensureBlock(), null, null)
+ listener: beginBlock({, BlockKind(statement))
+ notEofOrValue(}, print)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false)
+ looksLikeLocalFunction(print)
+ parseExpressionStatement({)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseSendOrFunctionLiteral({, expression)
+ looksLikeFunctionBody(;)
+ parseSend({, expression)
+ isNextIdentifier({)
+ ensureIdentifier({, expression)
+ listener: handleIdentifier(print, expression)
+ listener: handleNoTypeArguments(()
+ parseArgumentsOpt(print)
+ parseArguments(print)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseLiteralString(()
+ parseSingleLiteralString(()
+ listener: beginLiteralString("same")
+ listener: endLiteralString(0, ))
+ listener: endArguments(1, (, ))
+ listener: handleSend(print, ;)
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlock(1, {, }, BlockKind(statement))
+ listener: endThenStatement(})
+ listener: endIfStatement(if, null)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(5, {, })
+ listener: endTopLevelMethod(main, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(class)
+ listener: endCompilationUnit(2, )
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.parser.expect b/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.parser.expect
new file mode 100644
index 0000000..71e5cb1
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.parser.expect
@@ -0,0 +1,31 @@
+NOTICE: Stream was rewritten by parser!
+
+class Foo {
+Foo operator >>> (_) => this;
+}
+
+main() {
+Foo foo = new Foo();
+foo >>> 42;
+print(foo >>> 42);
+print(foo >>>= 42);
+if ((foo >>>= 42) == foo) {
+print("same");
+}
+}
+
+
+class[KeywordToken] Foo[StringToken] {[BeginToken]
+Foo[StringToken] operator[KeywordToken] >>>[ReplacementToken] ([BeginToken]_[StringToken])[SimpleToken] =>[SimpleToken] this[KeywordToken];[SimpleToken]
+}[SimpleToken]
+
+main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+Foo[StringToken] foo[StringToken] =[SimpleToken] new[KeywordToken] Foo[StringToken]([BeginToken])[SimpleToken];[SimpleToken]
+foo[StringToken] >>>[ReplacementToken] 42[StringToken];[SimpleToken]
+print[StringToken]([BeginToken]foo[StringToken] >>>[ReplacementToken] 42[StringToken])[SimpleToken];[SimpleToken]
+print[StringToken]([BeginToken]foo[StringToken] >>>=[ReplacementToken] 42[StringToken])[SimpleToken];[SimpleToken]
+if[KeywordToken] ([BeginToken]([BeginToken]foo[StringToken] >>>=[ReplacementToken] 42[StringToken])[SimpleToken] ==[SimpleToken] foo[StringToken])[SimpleToken] {[BeginToken]
+print[StringToken]([BeginToken]"same"[StringToken])[SimpleToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.scanner.expect b/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.scanner.expect
new file mode 100644
index 0000000..e7c9bf6
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.scanner.expect
@@ -0,0 +1,29 @@
+class Foo {
+Foo operator >>>(_) => this;
+}
+
+main() {
+Foo foo = new Foo();
+foo >>> 42;
+print(foo >>> 42);
+print(foo >>>= 42);
+if ((foo >>>= 42) == foo) {
+print("same");
+}
+}
+
+
+class[KeywordToken] Foo[StringToken] {[BeginToken]
+Foo[StringToken] operator[KeywordToken] >>[SimpleToken]>[SimpleToken]([BeginToken]_[StringToken])[SimpleToken] =>[SimpleToken] this[KeywordToken];[SimpleToken]
+}[SimpleToken]
+
+main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+Foo[StringToken] foo[StringToken] =[SimpleToken] new[KeywordToken] Foo[StringToken]([BeginToken])[SimpleToken];[SimpleToken]
+foo[StringToken] >>[SimpleToken]>[SimpleToken] 42[StringToken];[SimpleToken]
+print[StringToken]([BeginToken]foo[StringToken] >>[SimpleToken]>[SimpleToken] 42[StringToken])[SimpleToken];[SimpleToken]
+print[StringToken]([BeginToken]foo[StringToken] >>[SimpleToken]>=[SimpleToken] 42[StringToken])[SimpleToken];[SimpleToken]
+if[KeywordToken] ([BeginToken]([BeginToken]foo[StringToken] >>[SimpleToken]>=[SimpleToken] 42[StringToken])[SimpleToken] ==[SimpleToken] foo[StringToken])[SimpleToken] {[BeginToken]
+print[StringToken]([BeginToken]"same"[StringToken])[SimpleToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart b/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart
new file mode 100644
index 0000000..5ca7d9e
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart
@@ -0,0 +1,6 @@
+// From https://github.com/dart-lang/sdk/issues/46886
+
+void main(List<String> arguments) {
+ var x = 10 >>> 2;
+ print('x: $x');
+}
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart.expect b/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart.expect
new file mode 100644
index 0000000..a4925e8
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart.expect
@@ -0,0 +1,64 @@
+Problems reported:
+
+parser/no-triple-shift/simple_attempted_usage_of_triple_shift:4:14: This requires the 'triple-shift' language feature to be enabled.
+ var x = 10 >>> 2;
+ ^^^
+
+beginCompilationUnit(void)
+ beginMetadataStar(void)
+ endMetadataStar(0)
+ beginTopLevelMember(void)
+ beginTopLevelMethod(, null)
+ handleVoidKeyword(void)
+ handleIdentifier(main, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ beginMetadataStar(List)
+ endMetadataStar(0)
+ beginFormalParameter(List, MemberKind.TopLevelMethod, null, null, null)
+ handleIdentifier(List, typeReference)
+ beginTypeArguments(<)
+ handleIdentifier(String, typeReference)
+ handleNoTypeArguments(>)
+ handleType(String, null)
+ endTypeArguments(1, <, >)
+ handleType(List, null)
+ handleIdentifier(arguments, formalParameterDeclaration)
+ handleFormalParameterWithoutValue())
+ endFormalParameter(null, null, arguments, null, null, FormalParameterKind.mandatory, MemberKind.TopLevelMethod)
+ endFormalParameters(1, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(var)
+ endMetadataStar(0)
+ handleNoType(var)
+ beginVariablesDeclaration(x, null, var)
+ handleIdentifier(x, localVariableDeclaration)
+ beginInitializedIdentifier(x)
+ beginVariableInitializer(=)
+ handleLiteralInt(10)
+ handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >)
+ beginBinaryExpression(>>>)
+ handleLiteralInt(2)
+ endBinaryExpression(>>)
+ endVariableInitializer(=)
+ endInitializedIdentifier(x)
+ endVariablesDeclaration(1, ;)
+ handleIdentifier(print, expression)
+ handleNoTypeArguments(()
+ beginArguments(()
+ beginLiteralString('x: )
+ handleIdentifier(x, expression)
+ handleNoTypeArguments(')
+ handleNoArguments(')
+ handleSend(x, ')
+ handleInterpolationExpression($, null)
+ handleStringPart(')
+ endLiteralString(1, ))
+ endArguments(1, (, ))
+ handleSend(print, ;)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(2, {, })
+ endTopLevelMethod(void, null, })
+ endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart.intertwined.expect b/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart.intertwined.expect
new file mode 100644
index 0000000..7cb2b5a
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart.intertwined.expect
@@ -0,0 +1,130 @@
+parseUnit(void)
+ skipErrorTokens(void)
+ listener: beginCompilationUnit(void)
+ syntheticPreviousToken(void)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(void)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(void)
+ parseTopLevelMethod(, null, , Instance of 'VoidType', null, main, false)
+ listener: beginTopLevelMethod(, null)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(main, topLevelFunctionDeclaration)
+ parseMethodTypeVar(main)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(main, main, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(main, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ parseFormalParameter((, FormalParameterKind.mandatory, MemberKind.TopLevelMethod)
+ parseMetadataStar(()
+ listener: beginMetadataStar(List)
+ listener: endMetadataStar(0)
+ listener: beginFormalParameter(List, MemberKind.TopLevelMethod, null, null, null)
+ listener: handleIdentifier(List, typeReference)
+ listener: beginTypeArguments(<)
+ listener: handleIdentifier(String, typeReference)
+ listener: handleNoTypeArguments(>)
+ listener: handleType(String, null)
+ listener: endTypeArguments(1, <, >)
+ listener: handleType(List, null)
+ ensureIdentifier(>, formalParameterDeclaration)
+ listener: handleIdentifier(arguments, formalParameterDeclaration)
+ listener: handleFormalParameterWithoutValue())
+ listener: endFormalParameter(null, null, arguments, null, null, FormalParameterKind.mandatory, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(1, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, var)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers(var, {, null, var, null, false)
+ looksLikeLocalFunction(x)
+ listener: beginMetadataStar(var)
+ listener: endMetadataStar(0)
+ listener: handleNoType(var)
+ listener: beginVariablesDeclaration(x, null, var)
+ parseVariablesDeclarationRest(var, true)
+ parseOptionallyInitializedIdentifier(var)
+ ensureIdentifier(var, localVariableDeclaration)
+ listener: handleIdentifier(x, localVariableDeclaration)
+ listener: beginInitializedIdentifier(x)
+ parseVariableInitializerOpt(x)
+ listener: beginVariableInitializer(=)
+ parseExpression(=)
+ parsePrecedenceExpression(=, 1, true)
+ parseUnaryExpression(=, true)
+ parsePrimary(=, expression)
+ parseLiteralInt(=)
+ listener: handleLiteralInt(10)
+ reportRecoverableErrorWithEnd(>>, >, Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}])
+ listener: handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >)
+ rewriter()
+ listener: beginBinaryExpression(>>>)
+ parsePrecedenceExpression(>>>, 13, true)
+ parseUnaryExpression(>>>, true)
+ parsePrimary(>>>, expression)
+ parseLiteralInt(>>>)
+ listener: handleLiteralInt(2)
+ listener: endBinaryExpression(>>)
+ listener: endVariableInitializer(=)
+ listener: endInitializedIdentifier(x)
+ ensureSemicolon(2)
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, print)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(print)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ looksLikeFunctionBody(;)
+ parseSend(;, expression)
+ isNextIdentifier(;)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(print, expression)
+ listener: handleNoTypeArguments(()
+ parseArgumentsOpt(print)
+ parseArguments(print)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseLiteralString(()
+ parseSingleLiteralString(()
+ listener: beginLiteralString('x: )
+ parseIdentifierExpression($)
+ parseSend($, expression)
+ isNextIdentifier($)
+ ensureIdentifier($, expression)
+ listener: handleIdentifier(x, expression)
+ listener: handleNoTypeArguments(')
+ parseArgumentsOpt(x)
+ listener: handleNoArguments(')
+ listener: handleSend(x, ')
+ listener: handleInterpolationExpression($, null)
+ parseStringPart(x)
+ listener: handleStringPart(')
+ listener: endLiteralString(1, ))
+ listener: endArguments(1, (, ))
+ listener: handleSend(print, ;)
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(2, {, })
+ listener: endTopLevelMethod(void, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(void)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart.parser.expect b/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart.parser.expect
new file mode 100644
index 0000000..7249fbc
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart.parser.expect
@@ -0,0 +1,13 @@
+NOTICE: Stream was rewritten by parser!
+
+void main(List<String> arguments) {
+var x = 10 >>> 2;
+print('x: $x');
+}
+
+
+void[KeywordToken] main[StringToken]([BeginToken]List[StringToken]<[BeginToken]String[StringToken]>[SimpleToken] arguments[StringToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] x[StringToken] =[SimpleToken] 10[StringToken] >>>[ReplacementToken] 2[StringToken];[SimpleToken]
+print[StringToken]([BeginToken]'x: [StringToken]$[SimpleToken]x[StringToken]'[StringToken])[SimpleToken];[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart.scanner.expect b/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart.scanner.expect
new file mode 100644
index 0000000..6f63e7e
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/simple_attempted_usage_of_triple_shift.dart.scanner.expect
@@ -0,0 +1,11 @@
+void main(List<String> arguments) {
+var x = 10 >>> 2;
+print('x: $x');
+}
+
+
+void[KeywordToken] main[StringToken]([BeginToken]List[StringToken]<[BeginToken]String[StringToken]>[SimpleToken] arguments[StringToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] x[StringToken] =[SimpleToken] 10[StringToken] >>[SimpleToken]>[SimpleToken] 2[StringToken];[SimpleToken]
+print[StringToken]([BeginToken]'x: [StringToken]$[SimpleToken]x[StringToken]'[StringToken])[SimpleToken];[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart
new file mode 100644
index 0000000..a2b84b0
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart
@@ -0,0 +1,3 @@
+main() {
+ print(#>>>);
+}
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart.expect b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart.expect
new file mode 100644
index 0000000..0b9ca1d
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart.expect
@@ -0,0 +1,38 @@
+Problems reported:
+
+parser/no-triple-shift/triple_shift_symbol:2:13: Expected an identifier, but got ')'.
+ print(#>>>);
+ ^
+
+beginCompilationUnit(main)
+ beginMetadataStar(main)
+ endMetadataStar(0)
+ beginTopLevelMember(main)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(main, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ handleIdentifier(print, expression)
+ handleNoTypeArguments(()
+ beginArguments(()
+ beginLiteralSymbol(#)
+ handleOperator(>>)
+ endLiteralSymbol(#, 1)
+ beginBinaryExpression(>)
+ handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., Try inserting an identifier before ')'., {lexeme: )}], ), ))
+ handleIdentifier(, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(, ))
+ endBinaryExpression(>)
+ endArguments(1, (, ))
+ handleSend(print, ;)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(1, {, })
+ endTopLevelMethod(main, null, })
+ endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart.intertwined.expect b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart.intertwined.expect
new file mode 100644
index 0000000..9a4f6ba
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart.intertwined.expect
@@ -0,0 +1,83 @@
+parseUnit(main)
+ skipErrorTokens(main)
+ listener: beginCompilationUnit(main)
+ syntheticPreviousToken(main)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(main)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(main)
+ isReservedKeyword(()
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, main, false)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifierPotentiallyRecovered(, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(main, topLevelFunctionDeclaration)
+ parseMethodTypeVar(main)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(main, main, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(main, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, print)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false)
+ looksLikeLocalFunction(print)
+ parseExpressionStatement({)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseSendOrFunctionLiteral({, expression)
+ looksLikeFunctionBody(;)
+ parseSend({, expression)
+ isNextIdentifier({)
+ ensureIdentifier({, expression)
+ listener: handleIdentifier(print, expression)
+ listener: handleNoTypeArguments(()
+ parseArgumentsOpt(print)
+ parseArguments(print)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseLiteralSymbol(()
+ listener: beginLiteralSymbol(#)
+ listener: handleOperator(>>)
+ listener: endLiteralSymbol(#, 1)
+ listener: beginBinaryExpression(>)
+ parsePrecedenceExpression(>, 9, true)
+ parseUnaryExpression(>, true)
+ parsePrimary(>, expression)
+ parseSend(>, expression)
+ isNextIdentifier(>)
+ ensureIdentifier(>, expression)
+ reportRecoverableErrorWithToken(), Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., Try inserting an identifier before ')'., {lexeme: )}], ), ))
+ rewriter()
+ listener: handleIdentifier(, expression)
+ listener: handleNoTypeArguments())
+ parseArgumentsOpt()
+ listener: handleNoArguments())
+ listener: handleSend(, ))
+ listener: endBinaryExpression(>)
+ listener: endArguments(1, (, ))
+ listener: handleSend(print, ;)
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endTopLevelMethod(main, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(main)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart.parser.expect b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart.parser.expect
new file mode 100644
index 0000000..b608049
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart.parser.expect
@@ -0,0 +1,11 @@
+NOTICE: Stream was rewritten by parser!
+
+main() {
+print(#>>>*synthetic*);
+}
+
+
+main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+print[StringToken]([BeginToken]#[SimpleToken]>>[SimpleToken]>[SimpleToken][SyntheticStringToken])[SimpleToken];[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart.scanner.expect b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart.scanner.expect
new file mode 100644
index 0000000..604d5d7
--- /dev/null
+++ b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_symbol.dart.scanner.expect
@@ -0,0 +1,9 @@
+main() {
+print(#>>>);
+}
+
+
+main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+print[StringToken]([BeginToken]#[SimpleToken]>>[SimpleToken]>[SimpleToken])[SimpleToken];[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/test/fasta/parser/token_stream_rewriter_test.dart b/pkg/front_end/test/fasta/parser/token_stream_rewriter_test.dart
index 3d26339..713d142 100644
--- a/pkg/front_end/test/fasta/parser/token_stream_rewriter_test.dart
+++ b/pkg/front_end/test/fasta/parser/token_stream_rewriter_test.dart
@@ -207,6 +207,58 @@
normalTestDone(rewriter, a);
}
+ void test_replaceNextTokensWithSyntheticToken_1() {
+ Token a = _makeToken(0, 'a');
+ StringToken b = _makeToken(5, 'b');
+ b.precedingComments = new CommentToken.fromSubstring(
+ TokenType.SINGLE_LINE_COMMENT, "Test comment", 1, 9, 1,
+ canonicalize: true);
+ Token c = _makeToken(10, 'c');
+ Token d = _makeToken(11, 'd');
+ Token e = _makeToken(12, 'e');
+ _link([a, b, c, d, e]);
+ setupDone(a);
+
+ TokenStreamRewriter rewriter = getTokenStreamRewriter();
+ ReplacementToken replacement = rewriter
+ .replaceNextTokensWithSyntheticToken(a, 3, TokenType.AMPERSAND);
+ expect(b.offset, same(replacement.offset));
+ expect(b.precedingComments, same(replacement.precedingComments));
+ expect(replacement.replacedToken, same(b));
+ expect(replacement.replacedToken.next, same(c));
+ expect(replacement.replacedToken.next.next, same(d));
+
+ expect(a.next, same(replacement));
+ expect(replacement.next, same(e));
+ expect(e.next.isEof, true);
+
+ normalTestDone(rewriter, a);
+ }
+
+ void test_replaceNextTokensWithSyntheticToken_2() {
+ Token a = _makeToken(0, 'a');
+ StringToken b = _makeToken(5, 'b');
+ b.precedingComments = new CommentToken.fromSubstring(
+ TokenType.SINGLE_LINE_COMMENT, "Test comment", 1, 9, 1,
+ canonicalize: true);
+ Token c = _makeToken(10, 'c');
+ _link([a, b, c]);
+ setupDone(a);
+
+ TokenStreamRewriter rewriter = getTokenStreamRewriter();
+ ReplacementToken replacement = rewriter
+ .replaceNextTokensWithSyntheticToken(a, 2, TokenType.AMPERSAND);
+ expect(b.offset, same(replacement.offset));
+ expect(b.precedingComments, same(replacement.precedingComments));
+ expect(replacement.replacedToken, same(b));
+ expect(replacement.replacedToken.next, same(c));
+
+ expect(a.next, same(replacement));
+ expect(replacement.next.isEof, true);
+
+ normalTestDone(rewriter, a);
+ }
+
void test_moveSynthetic() {
ScannerResult scanResult = scanString('Foo(bar; baz=0;');
expect(scanResult.hasErrors, isTrue);
diff --git a/pkg/front_end/testcases/triple_shift/invalid_operator.dart.textual_outline.expect b/pkg/front_end/testcases/triple_shift/invalid_operator.dart.textual_outline.expect
index a449983..7faa576 100644
--- a/pkg/front_end/testcases/triple_shift/invalid_operator.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/triple_shift/invalid_operator.dart.textual_outline.expect
@@ -1,29 +1,22 @@
class Operators1 {
- operator >>(){}
- operator>() => true;
+ operator >>> () => true;
}
class Operators2 {
- operator >>(){}
- operator>(a, b) => true;
+ operator >>> (a, b) => true;
}
class Operators3 {
- operator >>(){}
- operator>([a]) => true;
+ operator >>> ([a]) => true;
}
class Operators4 {
- operator >>(){}
- operator>({a}) => true;
+ operator >>> ({a}) => true;
}
class Operators5 {
- operator >>(){}
- operator>(a, [b]) => true;
+ operator >>> (a, [b]) => true;
}
class Operators6 {
- operator >>(){}
- operator>(a, {b}) => true;
+ operator >>> (a, {b}) => true;
}
class Operators7 {
- operator >>(){}
- operator><T>(a) => true;
+ operator >>> <T>(a) => true;
}
main() {}
diff --git a/pkg/front_end/tool/ast_model.dart b/pkg/front_end/tool/ast_model.dart
index ae209a2..4deffd1 100644
--- a/pkg/front_end/tool/ast_model.dart
+++ b/pkg/front_end/tool/ast_model.dart
@@ -14,7 +14,9 @@
import 'package:kernel/class_hierarchy.dart';
import 'package:kernel/core_types.dart';
import 'package:kernel/src/printer.dart';
+import 'package:kernel/target/targets.dart';
import 'package:kernel/type_environment.dart';
+import 'package:vm/target/vm.dart';
final Uri astLibraryUri = Uri.parse('package:kernel/ast.dart');
final Uri canonicalNameLibraryUri =
@@ -508,6 +510,10 @@
bool errorsFound = false;
CompilerOptions options = new CompilerOptions();
options.sdkRoot = computePlatformBinariesLocation(forceBuildDir: true);
+ options.compileSdk = true;
+ options.target = new VmTarget(new TargetFlags());
+ options.librariesSpecificationUri = repoDir.resolve("sdk/lib/libraries.json");
+ options.environmentDefines = const {};
options.packagesFileUri = computePackageConfig(repoDir);
options.onDiagnostic = (DiagnosticMessage message) {
printDiagnosticMessage(message, print);
diff --git a/sdk/lib/core/list.dart b/sdk/lib/core/list.dart
index 585845a..8ac4701 100644
--- a/sdk/lib/core/list.dart
+++ b/sdk/lib/core/list.dart
@@ -137,7 +137,7 @@
/// ```dart
/// List<dynamic> dynList = ...some JSON value...;
/// List<Map<String, dynamic>> fooList =
- /// List.from(dynList.where((x) => x is Map && map["kind"] == "foo"));
+ /// List.from(dynList.where((x) => x is Map && x["kind"] == "foo"));
/// ```
///
/// This constructor creates a growable list when [growable] is true;
diff --git a/tests/language/const/factory_member_test.dart b/tests/language/const/factory_member_test.dart
new file mode 100644
index 0000000..5111a47
--- /dev/null
+++ b/tests/language/const/factory_member_test.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:math';
+import 'package:expect/expect.dart';
+
+abstract class A {
+ A.named(this.x5);
+ const factory A() = B;
+
+ // No constant expression will evaluate to an instance of `A`, so
+ // there is no need to live up to the constant related constraints,
+ // we can have instance variables of various kinds, even mutable:
+
+ final List<Never> x1 = [];
+ abstract String x2;
+ late final int x3 = Random().nextInt(10000);
+ late final int x4;
+ double? x5;
+}
+
+class B implements A {
+ const B([this.x5 = 0.57721566490153286]) : x1 = const [];
+
+ // Implement the interface of `A` appropriately for a constant.
+
+ final List<Never> x1;
+
+ final String x2 = 'B.x2';
+ set x2(String _) {}
+
+ int get x3 => 42;
+
+ int get x4 => -42;
+ set x4(_) {}
+
+ final double? x5;
+ set x5(double? _) {}
+}
+
+void main() {
+ const A();
+ const B(2.1);
+ Expect.isTrue(identical(const B(0.57721566490153286), const A()));
+}
diff --git a/tools/VERSION b/tools/VERSION
index 54822a8..f2a156c 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 58
+PRERELEASE 59
PRERELEASE_PATCH 0
\ No newline at end of file