Analyzer crashes when analyzing a package with a different meta version #46183
Labels
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P1
A high priority bug; for example, a single project is unusable or has many test failures
When the analyzer is analyzing a package using a different version of
meta
than the one it was compiled with, it may crash:It looks like the culprit is this logic here:
sdk/pkg/analyzer/lib/src/error/best_practices_verifier.dart
Lines 1626 to 1629 in 0742ed6
kindObject.getField('index')!.toIntValue()!
refers to the index of the value in the actual meta package used by the code analyzed. However,TargetKind.values
may be a different meta version (the one used when the SDK was built). Due to this mismatch, the analyzer may resolve to a wrongTargetKind
. If a newmeta
update adds a newTargetKind
with a higher index than what's available in the meta version used to compile the SDK, the analyzer crashes.To reproduce:
I'll contribute a fix myself, just wanted to report this first.
The text was updated successfully, but these errors were encountered: