Files
sdk/pkg/front_end/parser_testcases/patterns/syntheticIdentifier_insideMapPattern.dart.expect
T
Paul Berry d579b03f71 [messages] Use withArguments for diagnostics translated by the analyzer.
Changes the `front_end` and `_fe_analyzer_shared` code that reports
the following diagnostics so that it uses `withArguments` rather than
`withArgumentsOld`:

- `expectedButGot`
- `expectedButGot2`
- `expectedAfterButGot`
- `expectedToken`
- `unmatchedToken`
- `constFieldWithoutInitializer`
- `finalFieldWithoutInitializer`
- `superclassHasNoMethod`
- `unavailableDartLibrary`
- `unsupportedPlatformDartLibraryImport`

These messages required special care because they are translated into
analyzer diagnostics by the analyzer method
`FastaErrorReporter.reportByCode`, and the logic to do the translation
depends on the exact parameter names used by the messages.

For some of the messages I've clarified the parameter names and
updated `FastaErrorReporter.reportByCode` accordingly. For others, I
left the parameter names as is.

Change-Id: I6a6a696481c75f4cbb198d1e012aa1ca4294ed61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476323
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-01-30 10:12:42 -08:00

95 lines
4.1 KiB
Plaintext

Problems reported:
parser/patterns/syntheticIdentifier_insideMapPattern:3:14: Expected an identifier, but got 'if'.
case {0: if}:
^^
parser/patterns/syntheticIdentifier_insideMapPattern:3:14: Expected ',' before this.
case {0: if}:
^^
parser/patterns/syntheticIdentifier_insideMapPattern:3:14: Expected an identifier, but got 'if'.
case {0: if}:
^^
parser/patterns/syntheticIdentifier_insideMapPattern:3:14: Expected ':' before this.
case {0: if}:
^^
parser/patterns/syntheticIdentifier_insideMapPattern:3:14: Expected an identifier, but got 'if'.
case {0: if}:
^^
beginCompilationUnit(void)
beginMetadataStar(void)
endMetadataStar(0)
beginTopLevelMember(void)
beginTopLevelMethod(, null, null)
handleVoidKeyword(void)
handleIdentifier(f, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
beginMetadataStar(Object)
endMetadataStar(0)
beginFormalParameter(Object, MemberKind.TopLevelMethod, null, null, null)
handleIdentifier(Object, typeReference)
handleNoTypeArguments(?)
handleType(Object, ?)
handleIdentifier(x, formalParameterDeclaration)
handleFormalParameterWithoutValue())
endFormalParameter(null, null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.TopLevelMethod)
endFormalParameters(1, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginBlockFunctionBody({)
beginSwitchStatement(switch)
handleIdentifier(x, expression)
handleNoTypeArguments())
handleNoArguments())
handleSend(x, x)
handleParenthesizedCondition((, null, null)
beginSwitchBlock({)
beginCaseExpression(case)
beginPattern(case)
handleNoTypeArguments({)
handleLiteralInt(0)
beginPattern(:)
beginConstantPattern(null)
handleRecoverableError(Message[Template(ExpectedIdentifier), Expected an identifier, but got 'if'., Try inserting an identifier before 'if'., {lexeme: if}], if, if)
handleIdentifier(, expression)
handleNoTypeArguments(if)
handleNoArguments(if)
handleSend(, )
endConstantPattern(null)
endPattern()
handleMapPatternEntry(:, if)
handleRecoverableError(Message[Template(ExpectedButGot), Expected ',' before this., null, {expected: ,}], if, if)
handleRecoverableError(Message[Template(ExpectedIdentifier), Expected an identifier, but got 'if'., Try inserting an identifier before 'if'., {lexeme: if}], if, if)
handleIdentifier(, expression)
handleNoTypeArguments(if)
handleNoArguments(if)
handleSend(, )
handleRecoverableError(Message[Template(ExpectedButGot), Expected ':' before this., null, {expected: :}], if, if)
beginPattern(:)
beginConstantPattern(null)
handleRecoverableError(Message[Template(ExpectedIdentifier), Expected an identifier, but got 'if'., Try inserting an identifier before 'if'., {lexeme: if}], if, if)
handleIdentifier(, expression)
handleNoTypeArguments(if)
handleNoArguments(if)
handleSend(, )
endConstantPattern(null)
endPattern()
handleMapPatternEntry(:, })
handleMapPattern(2, {, })
endPattern(})
handleSwitchCaseNoWhenClause(})
endCaseExpression(case, null, :)
beginSwitchCase(0, 1, case)
endSwitchCase(0, 1, null, null, 0, case, :)
endSwitchBlock(1, {, })
endSwitchStatement(switch, })
handleEmptyStatement(;)
endBlockFunctionBody(2, {, })
endTopLevelMethod(void, null, })
endTopLevelDeclaration(})
endCompilationUnit(1, )