@@ -125,7 +125,8 @@ abstract class TypeChecker {
125125
126126 /// Returns `true` if the type of [element] can be assigned to this type.
127127 bool isAssignableFrom (Element element) =>
128- isExactly (element) || _getAllSupertypes (element).any (isExactlyType);
128+ isExactly (element) ||
129+ (element is ClassElement && element.allSupertypes.any (isExactlyType));
129130
130131 /// Returns `true` if [staticType] can be assigned to this type.
131132 bool isAssignableFromType (DartType staticType) =>
@@ -164,29 +165,6 @@ abstract class TypeChecker {
164165 bool isSuperTypeOf (DartType staticType) => isSuperOf (staticType.element);
165166}
166167
167- // TODO(kevmoo) Remove when bug with `ClassElement.allSupertypes` is fixed
168- // https://github.com/dart-lang/sdk/issues/29767
169- Iterable <InterfaceType > _getAllSupertypes (Element element) sync * {
170- if (element is ClassElement ) {
171- var processed = new Set <InterfaceType >();
172- var toExplore = new List <InterfaceType >.from (element.allSupertypes);
173-
174- while (toExplore.isNotEmpty) {
175- var item = toExplore.removeLast ();
176-
177- if (processed.add (item)) {
178- yield item;
179-
180- // Now drill into nested superTypes - but make sure not to duplicate
181- // any of them.
182- toExplore.addAll (item.element.allSupertypes.where ((e) {
183- return ! toExplore.contains (e) && ! processed.contains (e);
184- }));
185- }
186- }
187- }
188- }
189-
190168// Checks a static type against another static type;
191169class _LibraryTypeChecker extends TypeChecker {
192170 final DartType _type;
0 commit comments