Skip to content

Ridiculous number of compiler errors for a missing open { on top-level #25652

Open
@DavidSouther

Description

@DavidSouther

Compare:
https://dartpad.dartlang.org/8f24e1eb9c237c01bcb3

http://www.typescriptlang.org/Playground#src=%0Afunction%20main()%0A%20%20var%20lines%20%3D%20getLines()%3B%0A%0A%20%20%2F%2F%20If%20result%20is%20non-null%2C%20print%20it.%0A%20%20if(lines%20!%3D%3D%20null)%20%7B%0A%09lines.forEach((line)%20%3D%3E%20console.log(line))%3B%0A%20%20%7D%0A%7D%0A%0Afunction%20getLines()%3A%20string%5B%5D%20%7B%0A%09return%20%5B%22%22%5D%0A%7D

Both have the same syntax error, a missing { on the function body.

Dart prints 8 errors, 7 of which are completely useless noise and one is in completely the wrong place (a full 3 lines from where the error actually is).

Typescript prints two - one at the method I messed up on, and one (correctly) at the end brace for that method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onanalyzer-recoveryarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.model-error-recoveryError recovery in analyzer/CFE.type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions