dev_compiler
dev_compiler copied to clipboard
promote some file: references to package: self refs?
I saw this when running dev_compiler on it's own source:
severe: [AnalyzerMessage] The getter 'evaluationResult' is not defined for the class 'ElementAnnotation' (lib/src/utils.dart, line 344, col 31)
severe: [AnalyzerMessage] The getter 'evaluationResult' is not defined for the class 'ElementAnnotation' (package:dev_compiler/src/utils.dart, line 344, col 31)
Which is the same error for the same file, just in one case referenced from a file: path and the other a package: self-reference. dev_compier might need to add some logic from promote some file: refs to package: ones in order to avoid this issue. @stereotype441 has implemented this for the CLI analyzer.
(also, the references in the dev_compiler source might want to be normalized)
ah, yes, we don't have the code from analyzer_cli that de-dup's these. :| in general our error reporting is a bit inferior to analyzer_cli's
hopefully our code goes away soon and we can just use analyzer_cli for checking. I guess in the meantime we can try and pull in more logic. (e.g. I recently pulled in the code to sort error messages, since otherwise the order depends on some internal analyzer hash tables)
(In the meantime I'd recommend dartanalyzer --strong for a better UI experience)
Running dartanalyzer --strong I see No issues found for my app, which is comforting but a bit misleading. I know that my app won't compile well with ddc due to package issues. If I run dartanalyzer --strong --package-warnings instead I see 58 errors, 335 warnings and 2 hints found. which is more expected.
Perhaps adding a --ddc mode to dartanalyzer would help here, or keeping some warning mechanism in dev_compiler. It would be great to have simple source of truth about whether my app will compile well. And if the warning mechanism is in a separate tool, it'd worry about version skew between what I'm using to compile and what I'm using to tell me about compilation issues.
Oh! you're right, we may promote analyzer warnings differently in --strong vs in dartdevc. CC @vsmenon @leafpetersen who may be looking into this.
anyway happy to try taking code from analyzer_cli to fix the de-duping issues. Want me to look into it?
The bit of code that does it is here:
https://github.com/dart-lang/analyzer_cli/blob/master/lib/src/driver.dart#L358
@stereotype441 and @pq have context as well -
Oh nice ... I wondered what "restoreUri" was for :)
@vsmenon and @sigmundch were looking into something like this
(the command line to DDC's modular compiler is quite different, but I think the issue is still there -- we don't know how to "promote" file URIs to package ones -- unless Vijay landed a fix recently and I forgot about it already)