Skip to content

Commit

Permalink
Version 2.14.2
Browse files Browse the repository at this point in the history
* Cherry-pick refs/changes/85/211085/1 to stable
* Cherry-pick refs/changes/65/213265/1 to stable
* Cherry-pick refs/changes/43/213043/1 to stable
* Cherry-pick a6f97d1 to stable
  • Loading branch information
athomas committed Sep 15, 2021
2 parents 2102c6c + 80c2f1c commit 3300f32
Show file tree
Hide file tree
Showing 42 changed files with 2,431 additions and 21 deletions.
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
## 2.14.0
## 2.14.2 - 2021-09-16

This is a patch release that fixes:

- two dartdoc crashes (issues [dart-lang/dartdoc#2740][] and
[dart-lang/dartdoc#2755][]).
- error messages when using the `>>>` operator on older language versions
(issue [#46886][]).
- invalid `pubspec.lock` paths on Windows (issue [dart-lang/pub#3012][]).

[dart-lang/dartdoc#2740]: https://github.com/dart-lang/dartdoc/issues/2740
[dart-lang/dartdoc#2755]: https://github.com/dart-lang/dartdoc/issues/2755
[#46886]: https://github.com/dart-lang/sdk/issues/46886
[#45767]: https://github.com/dart-lang/sdk/issues/45767
[dart-lang/pub#3012]: https://github.com/dart-lang/pub/issues/3012

## 2.14.1 - 2021-09-09

- Fixed an issue specific to the macOS ARM64 (Apple Silicon) SDK, where the Dart
commandline tools did not have the expected startup performance.

## 2.14.0 - 2021-09-09

### Language

Expand Down
4 changes: 2 additions & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ vars = {
# For more details, see https://github.com/dart-lang/sdk/issues/30164
"dart_style_rev": "06bfd19593ed84dd288f67e02c6a753e6516288a",

"dartdoc_rev" : "c9621b92c738ec21a348cc2de032858276e9c774",
"dartdoc_rev" : "a4ca86f9bf732d7adc4506f7373e0ed63251b646",
"devtools_rev" : "64cffbed6366329ad05e44d48fa2298367643bb6",
"jsshell_tag": "version:88.0",
"ffi_rev": "4dd32429880a57b64edaf54c9d5af8a9fa9a4ffb",
Expand Down Expand Up @@ -140,7 +140,7 @@ vars = {
"pool_rev": "7abe634002a1ba8a0928eded086062f1307ccfae",
"process_rev": "56ece43b53b64c63ae51ec184b76bd5360c28d0b",
"protobuf_rev": "c1eb6cb51af39ccbaa1a8e19349546586a5c8e31",
"pub_rev": "70b1a4f9229a36bac6340ec7eae2b2068baac96c",
"pub_rev": "214860e794076188869d586b047a4aaada1cb9a8",
"pub_semver_rev": "f50d80ef10c4b2fa5f4c8878036a4d9342c0cc82",
"resource_rev": "6b79867d0becf5395e5819a75720963b8298e9a7",
"root_certificates_rev": "692f6d6488af68e0121317a9c2c9eb393eb0ee50",
Expand Down
52 changes: 49 additions & 3 deletions pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3844,6 +3844,18 @@ class Parser {
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);
}
}
}

Expand Down Expand Up @@ -4418,9 +4430,7 @@ class Parser {
begin = next = token.next!;
// Fall through to parse the block.
} else {
token = ensureBlock(
token,
codes.templateExpectedFunctionBody,
token = ensureBlock(token, codes.templateExpectedFunctionBody,
/* missingBlockName = */ null);
listener.handleInvalidFunctionBody(token);
return token.endGroup!;
Expand Down Expand Up @@ -4883,6 +4893,19 @@ class Parser {
// Right associative, so we recurse at the same precedence
// level.
Token next = token.next!;
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"));
assert(next == operator);
next = rewriter.replaceNextTokensWithSyntheticToken(
token, 2, TokenType.GT_GT_GT_EQ);
operator = next;
}
token = optional('throw', next.next!)
? parseThrowExpression(next, /* allowCascades = */ false)
: parsePrecedenceExpression(next, level, allowCascades);
Expand Down Expand Up @@ -4964,6 +4987,21 @@ class Parser {
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"));
assert(next == operator);
next = rewriter.replaceNextTokensWithSyntheticToken(
token, 2, TokenType.GT_GT_GT);
operator = next;
}
}
listener.beginBinaryExpression(next);
// Left associative, so we recurse at the next higher
// precedence level.
Expand Down Expand Up @@ -5110,6 +5148,14 @@ class Parser {
return SELECTOR_PRECEDENCE;
}
return POSTFIX_PRECEDENCE;
} else if (identical(type, TokenType.GT_GT)) {
// ">>" followed by ">=" (without space between tokens) should for
// recovery be seen as ">>>=".
TokenType nextType = token.next!.type;
if (identical(nextType, TokenType.GT_EQ) &&
token.charEnd == token.next!.offset) {
return TokenType.GT_GT_GT_EQ.precedence;
}
} else if (identical(type, TokenType.QUESTION) &&
optional('[', token.next!)) {
// "?[" can be a null-aware bracket or a conditional. If it's a
Expand Down
28 changes: 28 additions & 0 deletions pkg/_fe_analyzer_shared/lib/src/parser/token_stream_rewriter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,34 @@ abstract class TokenStreamRewriter {
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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
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}], >>, >=)
handleLiteralInt(42)
handleAssignmentExpression(>>>=)
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}], >>, >=)
handleLiteralInt(42)
handleAssignmentExpression(>>>=)
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, )
Loading

0 comments on commit 3300f32

Please sign in to comment.