@@ -8,6 +8,7 @@ import 'package:analyzer/dart/element/element.dart';
88import 'package:analyzer/dart/element/type.dart' ;
99import 'package:analyzer/src/dart/element/element.dart' ;
1010import 'package:dartdoc/src/element_type.dart' ;
11+ import 'package:dartdoc/src/model/extension_target.dart' ;
1112import 'package:dartdoc/src/model/model.dart' ;
1213import 'package:quiver/iterables.dart' as quiver;
1314
@@ -24,7 +25,8 @@ class Extension extends Container
2425 ElementType .from (_extension.extendedType, library, packageGraph);
2526 }
2627
27- bool couldApplyTo (Class c) => _couldApplyTo (c.modelType);
28+ bool couldApplyTo <T extends ExtensionTarget >(T c) =>
29+ _couldApplyTo (c.modelType);
2830
2931 /// Return true if this extension could apply to [t] .
3032 bool _couldApplyTo (DefinedElementType t) {
@@ -40,13 +42,14 @@ class Extension extends Container
4042 .isSubtypeOf (extendedType.instantiatedType, t.instantiatedType);
4143
4244 bool isBoundSupertypeTo (DefinedElementType t) =>
43- _isBoundSupertypeTo (t.type , HashSet ());
45+ _isBoundSupertypeTo (t.instantiatedType , HashSet ());
4446
4547 /// Returns true if at least one supertype (including via mixins and
4648 /// interfaces) is equivalent to or a subtype of [extendedType] when
4749 /// instantiated to bounds.
48- bool _isBoundSupertypeTo (
49- InterfaceType superType, HashSet <InterfaceType > visited) {
50+ bool _isBoundSupertypeTo (DartType superType, HashSet <DartType > visited) {
51+ // Only InterfaceTypes can have superTypes.
52+ if (superType is ! InterfaceType ) return false ;
5053 ClassElement superClass = superType? .element;
5154 if (visited.contains (superType)) return false ;
5255 visited.add (superType);
0 commit comments