DescriptionRework type assignability, subtype, and "more specific than" checking.
The key change in this CL is to change the technique for avoiding
infinite recursion in the presence of illegal code. Rather than track
type pairs, we track (a) the function typedef elements that have been
expanded while examining the LHS and RHS, and (b) the class and type
parameter elements that have been visited while exploring the class
hierarchy. If a function typedef is encountered while expanding
itself, or a class or type parameter element is encountered while
searching its own class hierarchy, then it is skipped. Since both
class hierarchy loops and self-referential function typedefs are
prohibited by the spec, this ensures that the checks to avoid
recursion will only trigger in the presence of compile errors, so
analyzer will produce correct warnings in the absence of compile
errors.
As a consequence of the new technique, bugs 21912 and 22976 are fixed.
In addition, there are a few other improvements:
- Optional arguments are used to keep track of elements already
visited, so it's not necessary to have separate functions
isAssignableTo2, isSubtypeOf2, and isMoreSpecificThan2, nor do we
need "internal" versions of those functions.
- InterfaceTypeImpl no longer needs a special implementation of
isSubtypeOf. It's now implemented in the same way it's defined (in
terms of isMoreSpecificThan).
- Some flaws were discovered in the co19 tests. I've filed a co19 bug
for these, and updated the co19-analyzer2 status file.
R=brianwilkerson@google.com
Committed: https://code.google.com/p/dart/source/detail?r=44965
Patch Set 1 #
Total comments: 2
Messages
Total messages: 5 (1 generated)
|