Skip to content

Commit 0937087

Browse files
johnniwintherCommit Queue
authored and
Commit Queue
committed
[parser] Improve error recovery for constant patterns
This allows the parser to parse constant patterns at lower precedence level in order to recognize more expressions in this context. To support this, _parsePrecedenceExpressionLoop special cases a few cases that should _not_ be parsed as expression in a constant pattern context. Closes #50996 Change-Id: I43bb0ce52d366bd2dfcf47e12eec5883402f668a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282100 Commit-Queue: Johnni Winther <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Jens Johansen <[email protected]>
1 parent 7a18d3c commit 0937087

File tree

210 files changed

+6826
-1715
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+6826
-1715
lines changed

pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6925,6 +6925,34 @@ const MessageCode messageInvalidCodePoint = const MessageCode(
69256925
problemMessage:
69266926
r"""The escape sequence starting with '\u' isn't a valid code point.""");
69276927

6928+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
6929+
const Template<
6930+
Message Function(
6931+
String
6932+
name)> templateInvalidConstantPatternBinary = const Template<
6933+
Message Function(String name)>(
6934+
problemMessageTemplate:
6935+
r"""The binary operator #name is not supported as a constant pattern.""",
6936+
correctionMessageTemplate:
6937+
r"""Try wrapping the expression in 'const ( ... )'.""",
6938+
withArguments: _withArgumentsInvalidConstantPatternBinary);
6939+
6940+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
6941+
const Code<Message Function(String name)> codeInvalidConstantPatternBinary =
6942+
const Code<Message Function(String name)>("InvalidConstantPatternBinary",
6943+
index: 141);
6944+
6945+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
6946+
Message _withArgumentsInvalidConstantPatternBinary(String name) {
6947+
if (name.isEmpty) throw 'No name provided';
6948+
name = demangleMixinApplicationName(name);
6949+
return new Message(codeInvalidConstantPatternBinary,
6950+
problemMessage:
6951+
"""The binary operator ${name} is not supported as a constant pattern.""",
6952+
correctionMessage: """Try wrapping the expression in 'const ( ... )'.""",
6953+
arguments: {'name': name});
6954+
}
6955+
69286956
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
69296957
const Code<Null> codeInvalidConstantPatternConstPrefix =
69306958
messageInvalidConstantPatternConstPrefix;

pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ import '../scanner/token.dart'
1919
CASCADE_PRECEDENCE,
2020
EQUALITY_PRECEDENCE,
2121
Keyword,
22+
MULTIPLICATIVE_PRECEDENCE,
2223
POSTFIX_PRECEDENCE,
24+
PREFIX_PRECEDENCE,
2325
RELATIONAL_PRECEDENCE,
2426
SELECTOR_PRECEDENCE,
2527
SHIFT_PRECEDENCE,
@@ -5661,6 +5663,48 @@ class Parser {
56615663
Token next = token.next!;
56625664
TokenType type = next.type;
56635665
int tokenLevel = _computePrecedence(next, forPattern: false);
5666+
if (constantPatternContext != ConstantPatternContext.none) {
5667+
// For error recovery we allow too much when parsing constant patterns,
5668+
// so for the cases that shouldn't be parsed as expressions in this
5669+
// context we return directly.
5670+
if (type == TokenType.BANG) {
5671+
if (tokenLevel == POSTFIX_PRECEDENCE) {
5672+
// This is a suffixed ! which is a null assert pattern.
5673+
return token;
5674+
} else if (optional('?', next.next!)) {
5675+
// This is a suffixed !? which is a null assert pattern in a null
5676+
// check pattern.
5677+
return token;
5678+
}
5679+
} else if (type == TokenType.AS) {
5680+
// This is a suffixed `as` which is a case pattern.
5681+
return token;
5682+
}
5683+
}
5684+
if (constantPatternContext != ConstantPatternContext.none &&
5685+
precedence <= tokenLevel &&
5686+
tokenLevel < SELECTOR_PRECEDENCE) {
5687+
// If we are parsing a constant pattern, only [SELECTOR_PRECEDENCE] is
5688+
// supported but we allow for parsing [EQUALITY_PRECEDENCE] and higher for
5689+
// better error recovery.
5690+
if (constantPatternContext == ConstantPatternContext.explicit) {
5691+
reportRecoverableError(
5692+
token, codes.messageInvalidConstantPatternConstPrefix);
5693+
} else if (tokenLevel <= MULTIPLICATIVE_PRECEDENCE) {
5694+
reportRecoverableError(
5695+
next,
5696+
codes.templateInvalidConstantPatternBinary
5697+
.withArguments(type.lexeme));
5698+
} else {
5699+
// These are prefix or postfix ++/-- and will not be constant
5700+
// expressions, anyway.
5701+
assert(
5702+
tokenLevel == POSTFIX_PRECEDENCE || tokenLevel == PREFIX_PRECEDENCE,
5703+
"Unexpected precedence level for $type: $tokenLevel");
5704+
}
5705+
// Avoid additional constant pattern errors.
5706+
constantPatternContext = ConstantPatternContext.none;
5707+
}
56645708
bool enteredLoop = false;
56655709
for (int level = tokenLevel; level >= precedence; --level) {
56665710
int lastBinaryExpressionLevel = -1;
@@ -5801,6 +5845,24 @@ class Parser {
58015845
next = token.next!;
58025846
type = next.type;
58035847
tokenLevel = _computePrecedence(next, forPattern: false);
5848+
if (constantPatternContext != ConstantPatternContext.none) {
5849+
// For error recovery we allow too much when parsing constant
5850+
// patterns, so for the cases that shouldn't be parsed as expressions
5851+
// in this context we break out of the parsing loop directly.
5852+
if (type == TokenType.BANG) {
5853+
if (tokenLevel == POSTFIX_PRECEDENCE) {
5854+
// This is a suffixed ! which is a null assert pattern.
5855+
return token;
5856+
} else if (optional('?', next.next!)) {
5857+
// This is a suffixed !? which is a null assert pattern in a null
5858+
// check pattern.
5859+
return token;
5860+
}
5861+
} else if (type == TokenType.AS) {
5862+
// This is a suffixed `as` which is a case pattern.
5863+
return token;
5864+
}
5865+
}
58045866
}
58055867
if (_recoverAtPrecedenceLevel && !_currentlyRecovering) {
58065868
// Attempt recovery
@@ -9657,7 +9719,10 @@ class Parser {
96579719
// | 'const' '(' expression ')'
96589720
Token const_ = next;
96599721
listener.beginConstantPattern(const_);
9660-
token = parsePrecedenceExpression(const_, SELECTOR_PRECEDENCE,
9722+
// The supported precedence is [SELECTOR_PRECEDENCE] but for better
9723+
// error recovery we allow for parsing [EQUALITY_PRECEDENCE] and higher,
9724+
// and report an error in [_parsePrecedenceExpressionLoop] instead.
9725+
token = parsePrecedenceExpression(const_, EQUALITY_PRECEDENCE,
96619726
/* allowCascades = */ false, ConstantPatternContext.explicit);
96629727
listener.endConstantPattern(const_);
96639728
return token;
@@ -9728,7 +9793,10 @@ class Parser {
97289793
token = beforeFirstIdentifier;
97299794
}
97309795
listener.beginConstantPattern(/* constKeyword = */ null);
9731-
token = parsePrecedenceExpression(token, SELECTOR_PRECEDENCE,
9796+
// The supported precedence is [SELECTOR_PRECEDENCE] but for better
9797+
// error recovery we allow for parsing [EQUALITY_PRECEDENCE] and higher,
9798+
// and report an error in [_parsePrecedenceExpressionLoop] instead.
9799+
token = parsePrecedenceExpression(token, EQUALITY_PRECEDENCE,
97329800
/* allowCascades = */ false, ConstantPatternContext.implicit);
97339801
listener.endConstantPattern(/* constKeyword = */ null);
97349802
return token;

pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,6 +2307,8 @@ ParserErrorCode.INVALID_COMMENT_REFERENCE:
23072307
status: needsEvaluation
23082308
ParserErrorCode.INVALID_CONSTANT_CONST_PREFIX:
23092309
status: needsEvaluation
2310+
ParserErrorCode.INVALID_CONSTANT_PATTERN_BINARY:
2311+
status: needsEvaluation
23102312
ParserErrorCode.INVALID_CONSTANT_PATTERN_DUPLICATE_CONST:
23112313
status: needsEvaluation
23122314
ParserErrorCode.INVALID_CONSTANT_PATTERN_EMPTY_RECORD_LITERAL:

pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ final fastaAnalyzerErrorCodes = <ErrorCode?>[
155155
ParserErrorCode.INVALID_CONSTANT_PATTERN_EMPTY_RECORD_LITERAL,
156156
ParserErrorCode.INVALID_CONSTANT_PATTERN_GENERIC,
157157
ParserErrorCode.INVALID_CONSTANT_CONST_PREFIX,
158+
ParserErrorCode.INVALID_CONSTANT_PATTERN_BINARY,
158159
];
159160

160161
class ParserErrorCode extends ErrorCode {
@@ -922,6 +923,13 @@ class ParserErrorCode extends ErrorCode {
922923
"Try wrapping the expression in 'const ( ... )' instead.",
923924
);
924925

926+
static const ParserErrorCode INVALID_CONSTANT_PATTERN_BINARY =
927+
ParserErrorCode(
928+
'INVALID_CONSTANT_PATTERN_BINARY',
929+
"The binary operator {0} is not supported as a constant pattern.",
930+
correctionMessage: "Try wrapping the expression in 'const ( ... )'.",
931+
);
932+
925933
static const ParserErrorCode INVALID_CONSTANT_PATTERN_DUPLICATE_CONST =
926934
ParserErrorCode(
927935
'INVALID_CONSTANT_PATTERN_DUPLICATE_CONST',

pkg/analyzer/lib/src/error/error_code_values.g.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,7 @@ const List<ErrorCode> errorCodeValues = [
763763
ParserErrorCode.INVALID_CODE_POINT,
764764
ParserErrorCode.INVALID_COMMENT_REFERENCE,
765765
ParserErrorCode.INVALID_CONSTANT_CONST_PREFIX,
766+
ParserErrorCode.INVALID_CONSTANT_PATTERN_BINARY,
766767
ParserErrorCode.INVALID_CONSTANT_PATTERN_DUPLICATE_CONST,
767768
ParserErrorCode.INVALID_CONSTANT_PATTERN_EMPTY_RECORD_LITERAL,
768769
ParserErrorCode.INVALID_CONSTANT_PATTERN_GENERIC,

pkg/front_end/messages.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6428,6 +6428,17 @@ InvalidConstantPatternConstPrefix:
64286428
if (x case const 1) {}
64296429
}
64306430
6431+
InvalidConstantPatternBinary:
6432+
problemMessage: "The binary operator #name is not supported as a constant pattern."
6433+
correctionMessage: "Try wrapping the expression in 'const ( ... )'."
6434+
analyzerCode: ParserErrorCode.INVALID_CONSTANT_PATTERN_BINARY
6435+
index: 141
6436+
experiments: patterns
6437+
script: |
6438+
method(x) {
6439+
if (x case 1 + 2) {}
6440+
}
6441+
64316442
PatternAssignmentDeclaresVariable:
64326443
problemMessage: "Variable '#name' can't be declared in a pattern assignment."
64336444
correctionMessage: "Try using a preexisting variable or changing the assignment to a pattern variable declaration."

pkg/front_end/parser_testcases/patterns/boolean_literal_inside_case.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ parseUnit(test)
7272
parsePattern(case, PatternContext.matching, precedence: 1)
7373
parsePrimaryPattern(case, PatternContext.matching)
7474
listener: beginConstantPattern(null)
75-
parsePrecedenceExpression(case, 17, false, ConstantPatternContext.implicit)
75+
parsePrecedenceExpression(case, 7, false, ConstantPatternContext.implicit)
7676
parseUnaryExpression(case, false, ConstantPatternContext.implicit)
7777
parsePrimary(case, expression, ConstantPatternContext.implicit)
7878
parseLiteralBool(case)

pkg/front_end/parser_testcases/patterns/boolean_literal_inside_cast.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ parseUnit(test)
7272
parsePattern(case, PatternContext.matching, precedence: 1)
7373
parsePrimaryPattern(case, PatternContext.matching)
7474
listener: beginConstantPattern(null)
75-
parsePrecedenceExpression(case, 17, false, ConstantPatternContext.implicit)
75+
parsePrecedenceExpression(case, 7, false, ConstantPatternContext.implicit)
7676
parseUnaryExpression(case, false, ConstantPatternContext.implicit)
7777
parsePrimary(case, expression, ConstantPatternContext.implicit)
7878
parseLiteralBool(case)

pkg/front_end/parser_testcases/patterns/boolean_literal_inside_if_case.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ parseUnit(test)
6464
parsePattern(case, PatternContext.matching, precedence: 1)
6565
parsePrimaryPattern(case, PatternContext.matching)
6666
listener: beginConstantPattern(null)
67-
parsePrecedenceExpression(case, 17, false, ConstantPatternContext.implicit)
67+
parsePrecedenceExpression(case, 7, false, ConstantPatternContext.implicit)
6868
parseUnaryExpression(case, false, ConstantPatternContext.implicit)
6969
parsePrimary(case, expression, ConstantPatternContext.implicit)
7070
parseLiteralBool(case)

pkg/front_end/parser_testcases/patterns/boolean_literal_inside_null_assert.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ parseUnit(test)
7272
parsePattern(case, PatternContext.matching, precedence: 1)
7373
parsePrimaryPattern(case, PatternContext.matching)
7474
listener: beginConstantPattern(null)
75-
parsePrecedenceExpression(case, 17, false, ConstantPatternContext.implicit)
75+
parsePrecedenceExpression(case, 7, false, ConstantPatternContext.implicit)
7676
parseUnaryExpression(case, false, ConstantPatternContext.implicit)
7777
parsePrimary(case, expression, ConstantPatternContext.implicit)
7878
parseLiteralBool(case)

pkg/front_end/parser_testcases/patterns/boolean_literal_inside_null_check.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ parseUnit(test)
7272
parsePattern(case, PatternContext.matching, precedence: 1)
7373
parsePrimaryPattern(case, PatternContext.matching)
7474
listener: beginConstantPattern(null)
75-
parsePrecedenceExpression(case, 17, false, ConstantPatternContext.implicit)
75+
parsePrecedenceExpression(case, 7, false, ConstantPatternContext.implicit)
7676
parseUnaryExpression(case, false, ConstantPatternContext.implicit)
7777
parsePrimary(case, expression, ConstantPatternContext.implicit)
7878
parseLiteralBool(case)

pkg/front_end/parser_testcases/patterns/caseHead_withClassicPattern_guarded_insideIfStatement.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ parseUnit(void)
6161
parsePattern(case, PatternContext.matching, precedence: 1)
6262
parsePrimaryPattern(case, PatternContext.matching)
6363
listener: beginConstantPattern(null)
64-
parsePrecedenceExpression(case, 17, false, ConstantPatternContext.implicit)
64+
parsePrecedenceExpression(case, 7, false, ConstantPatternContext.implicit)
6565
parseUnaryExpression(case, false, ConstantPatternContext.implicit)
6666
parsePrimary(case, expression, ConstantPatternContext.implicit)
6767
parseLiteralInt(case)

pkg/front_end/parser_testcases/patterns/caseHead_withClassicPattern_guarded_insideSwitchStatement.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ parseUnit(void)
6969
parsePattern(case, PatternContext.matching, precedence: 1)
7070
parsePrimaryPattern(case, PatternContext.matching)
7171
listener: beginConstantPattern(null)
72-
parsePrecedenceExpression(case, 17, false, ConstantPatternContext.implicit)
72+
parsePrecedenceExpression(case, 7, false, ConstantPatternContext.implicit)
7373
parseUnaryExpression(case, false, ConstantPatternContext.implicit)
7474
parsePrimary(case, expression, ConstantPatternContext.implicit)
7575
parseLiteralInt(case)

pkg/front_end/parser_testcases/patterns/caseHead_withClassicPattern_unguarded_insideIfStatement.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ parseUnit(void)
6161
parsePattern(case, PatternContext.matching, precedence: 1)
6262
parsePrimaryPattern(case, PatternContext.matching)
6363
listener: beginConstantPattern(null)
64-
parsePrecedenceExpression(case, 17, false, ConstantPatternContext.implicit)
64+
parsePrecedenceExpression(case, 7, false, ConstantPatternContext.implicit)
6565
parseUnaryExpression(case, false, ConstantPatternContext.implicit)
6666
parsePrimary(case, expression, ConstantPatternContext.implicit)
6767
parseLiteralInt(case)

pkg/front_end/parser_testcases/patterns/caseHead_withClassicPattern_unguarded_insideSwitchStatement.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ parseUnit(void)
6969
parsePattern(case, PatternContext.matching, precedence: 1)
7070
parsePrimaryPattern(case, PatternContext.matching)
7171
listener: beginConstantPattern(null)
72-
parsePrecedenceExpression(case, 17, false, ConstantPatternContext.implicit)
72+
parsePrecedenceExpression(case, 7, false, ConstantPatternContext.implicit)
7373
parseUnaryExpression(case, false, ConstantPatternContext.implicit)
7474
parsePrimary(case, expression, ConstantPatternContext.implicit)
7575
parseLiteralInt(case)

pkg/front_end/parser_testcases/patterns/caseHead_withNewPattern_guarded_insideIfStatement.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ parseUnit(void)
6161
parsePattern(case, PatternContext.matching, precedence: 1)
6262
parsePrimaryPattern(case, PatternContext.matching)
6363
listener: beginConstantPattern(null)
64-
parsePrecedenceExpression(case, 17, false, ConstantPatternContext.implicit)
64+
parsePrecedenceExpression(case, 7, false, ConstantPatternContext.implicit)
6565
parseUnaryExpression(case, false, ConstantPatternContext.implicit)
6666
parsePrimary(case, expression, ConstantPatternContext.implicit)
6767
parseLiteralInt(case)

pkg/front_end/parser_testcases/patterns/caseHead_withNewPattern_guarded_insideSwitchStatement.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ parseUnit(void)
6969
parsePattern(case, PatternContext.matching, precedence: 1)
7070
parsePrimaryPattern(case, PatternContext.matching)
7171
listener: beginConstantPattern(null)
72-
parsePrecedenceExpression(case, 17, false, ConstantPatternContext.implicit)
72+
parsePrecedenceExpression(case, 7, false, ConstantPatternContext.implicit)
7373
parseUnaryExpression(case, false, ConstantPatternContext.implicit)
7474
parsePrimary(case, expression, ConstantPatternContext.implicit)
7575
parseLiteralInt(case)

pkg/front_end/parser_testcases/patterns/caseHead_withNewPattern_unguarded_insideIfStatement.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ parseUnit(void)
6161
parsePattern(case, PatternContext.matching, precedence: 1)
6262
parsePrimaryPattern(case, PatternContext.matching)
6363
listener: beginConstantPattern(null)
64-
parsePrecedenceExpression(case, 17, false, ConstantPatternContext.implicit)
64+
parsePrecedenceExpression(case, 7, false, ConstantPatternContext.implicit)
6565
parseUnaryExpression(case, false, ConstantPatternContext.implicit)
6666
parsePrimary(case, expression, ConstantPatternContext.implicit)
6767
parseLiteralInt(case)

pkg/front_end/parser_testcases/patterns/caseHead_withNewPattern_unguarded_insideSwitchStatement.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ parseUnit(void)
6969
parsePattern(case, PatternContext.matching, precedence: 1)
7070
parsePrimaryPattern(case, PatternContext.matching)
7171
listener: beginConstantPattern(null)
72-
parsePrecedenceExpression(case, 17, false, ConstantPatternContext.implicit)
72+
parsePrecedenceExpression(case, 7, false, ConstantPatternContext.implicit)
7373
parseUnaryExpression(case, false, ConstantPatternContext.implicit)
7474
parsePrimary(case, expression, ConstantPatternContext.implicit)
7575
parseLiteralInt(case)

pkg/front_end/parser_testcases/patterns/cast_inside_case.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ parseUnit(test)
101101
parsePattern(case, PatternContext.matching, precedence: 1)
102102
parsePrimaryPattern(case, PatternContext.matching)
103103
listener: beginConstantPattern(null)
104-
parsePrecedenceExpression(case, 17, false, ConstantPatternContext.implicit)
104+
parsePrecedenceExpression(case, 7, false, ConstantPatternContext.implicit)
105105
parseUnaryExpression(case, false, ConstantPatternContext.implicit)
106106
parsePrimary(case, expression, ConstantPatternContext.implicit)
107107
parseSendOrFunctionLiteral(case, expression, ConstantPatternContext.implicit)

pkg/front_end/parser_testcases/patterns/cast_inside_extractor_pattern.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ parseUnit(class)
122122
parsePattern(:, PatternContext.matching, precedence: 1)
123123
parsePrimaryPattern(:, PatternContext.matching)
124124
listener: beginConstantPattern(null)
125-
parsePrecedenceExpression(:, 17, false, ConstantPatternContext.implicit)
125+
parsePrecedenceExpression(:, 7, false, ConstantPatternContext.implicit)
126126
parseUnaryExpression(:, false, ConstantPatternContext.implicit)
127127
parsePrimary(:, expression, ConstantPatternContext.implicit)
128128
parseLiteralInt(:)

pkg/front_end/parser_testcases/patterns/cast_inside_list_pattern.dart.intertwined.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ parseUnit(test)
7676
parsePattern([, PatternContext.matching, precedence: 1)
7777
parsePrimaryPattern([, PatternContext.matching)
7878
listener: beginConstantPattern(null)
79-
parsePrecedenceExpression([, 17, false, ConstantPatternContext.implicit)
79+
parsePrecedenceExpression([, 7, false, ConstantPatternContext.implicit)
8080
parseUnaryExpression([, false, ConstantPatternContext.implicit)
8181
parsePrimary([, expression, ConstantPatternContext.implicit)
8282
parseLiteralInt([)

0 commit comments

Comments
 (0)