Files
sdk/pkg/front_end/parser_testcases/coverage/string4.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

63 lines
2.3 KiB
Plaintext

Problems reported:
parser/coverage/string4:8:10: Expected ';' after this.
return r"""
^^^^^...
parser/coverage/string4:8:10: String starting with r""" must end with """.
return r"""
^^^^^...
parser/coverage/string4:7:12: Can't find '}' to match '{'.
void bar() {
^
beginCompilationUnit(void)
beginMetadataStar(void)
endMetadataStar(0)
beginTopLevelMember(void)
beginTopLevelMethod(UnmatchedToken({), null, null)
handleVoidKeyword(void)
handleIdentifier(foo, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginBlockFunctionBody({)
beginReturnStatement(return)
beginLiteralString(r"""
æbler
æbler""")
endLiteralString(0, ;)
endReturnStatement(true, return, ;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(void, null, })
endTopLevelDeclaration(})
beginMetadataStar(void)
endMetadataStar(0)
beginTopLevelMember(void)
beginTopLevelMethod(}, null, null)
handleVoidKeyword(void)
handleIdentifier(bar, topLevelFunctionDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.TopLevelMethod)
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
handleAsyncModifier(null, null)
beginBlockFunctionBody({)
beginReturnStatement(return)
beginLiteralString(r"""
æbler""")
endLiteralString(0, })
handleRecoverableError(Message[Template(ExpectedAfterButGot), Expected ';' after this., null, {expected: ;}], r"""
æbler""", r"""
æbler""")
endReturnStatement(true, return, ;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(void, null, })
endTopLevelDeclaration(})
handleErrorToken(UnterminatedString(r"""))
handleRecoverableError(Message[Template(UnterminatedString), String starting with r""" must end with """., null, {openQuote: r""", expectedCloseQuote: """}], UnterminatedString(r"""), UnterminatedString(r"""))
handleErrorToken(UnmatchedToken({))
handleRecoverableError(Message[Template(UnmatchedToken), Can't find '}' to match '{'., null, {expected: }, lexeme: {}], UnmatchedToken({), UnmatchedToken({))
endCompilationUnit(2, )