Skip to content

"dart analyze" output gives wrong file for context message #54717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
davidmorgan opened this issue Jan 24, 2024 · 0 comments
Open

"dart analyze" output gives wrong file for context message #54717

davidmorgan opened this issue Jan 24, 2024 · 0 comments
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-ux P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@davidmorgan
Copy link
Contributor

Forked from #54661

this command

DART_CONFIGURATION=ReleaseX64 out/ReleaseX64/dart-sdk/bin/dart out/ReleaseX64/gen/dartanalyzer.dart.snapshot -Dtest_runner.configuration=analyzer-asserts-linux --ignore-unrecognized-flags --packages=/usr/local/google/home/davidmorgan/git/dart-sdk/sdk/.dart_tool/package_config.json --format=json /usr/local/google/home/davidmorgan/git/dart-sdk/sdk/tests/co19/src/Language/Libraries_and_Scripts/Parts/compilation_t01.dart

results in correct JSON output, pointing to the duplicate in compilation_t04.dart:

"contextMessages":[{"message":"The first definition of this name.","location":{"file":"/usr/local/google/home/davidmorgan/git/dart-sdk/sdk/tests/co19/src/Language/Libraries_and_Scripts/Parts/compilation_t04.dart","offset":856,"length":3,"startLine":17,"startColumn":483,"endLine":17,"endColumn":486}}]

but the corresponding run of "dart analyze"

dart analyze tests/co19/src/Language/Libraries_and_Scripts/Parts/part_0.dart

reports the context message against the wrong file, against the part file:

  error • part_0.dart:16:5 • The name 'bar' is already defined. Try renaming one of the declarations. • duplicate_definition
           - The first definition of this name at part_0.dart:17:483.
@davidmorgan davidmorgan added the legacy-area-analyzer Use area-devexp instead. label Jan 24, 2024
@srawlins srawlins added P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jan 25, 2024
@bwilkerson bwilkerson added area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. and removed legacy-area-analyzer Use area-devexp instead. labels Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-ux P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants