-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.dart-model-analyzer-packageIssues related to package:analyzerIssues related to package:analyzertype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
The analyzer should include a Related Types analysis to flag errors like
m1(int i, String s) => i == s; // Trivially false unless i == s == null
m2(int i, Iterable<String> list) => list.contains(i); // Trivially false unless i == null
m3(int i, Map<String, int> map) => map[i]; // Trivially null unless i == null
A first implementation of the analysis could be hardwired to platform classes similarly to the EC bugs and GC bugs in FindBugs.
Determining which classes are unrelated should take built-in "final" classes like int and String into account, but also (with a lower severity) use the 'closed world' of all known classes to catch errors like:
class A {}
class B {}
m4(A a, Iterable<B> list) => list.contains(a); // Trivially false unless a == null
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.dart-model-analyzer-packageIssues related to package:analyzerIssues related to package:analyzertype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug