Index: pkg/analyzer/lib/src/dart/element/type.dart |
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart |
index 7e89111267204f50df81fa5282415dcf345cbd78..9dc98451a0c97b1811b4bf18fb3493231e069f6c 100644 |
--- a/pkg/analyzer/lib/src/dart/element/type.dart |
+++ b/pkg/analyzer/lib/src/dart/element/type.dart |
@@ -2660,9 +2660,47 @@ class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType { |
@override |
int get hashCode => element.hashCode; |
+ /** |
+ * Append a textual representation of this type to the given [buffer]. The set |
+ * of [visitedTypes] is used to prevent infinite recursion. |
+ */ |
+ void appendTo(StringBuffer buffer, Set<TypeImpl> visitedTypes) { |
+ super.appendTo(buffer, visitedTypes); |
+ TypeParameterElement e = element; |
+ if (e is TypeParameterMember && |
+ e.bound != e.baseElement.bound && |
+ !_appendingBounds) { |
+ buffer.write(' extends '); |
+ // If we're appending bounds already, we don't want to do it recursively. |
+ _appendingBounds = true; |
+ try { |
+ (e.bound as TypeImpl).appendTo(buffer, visitedTypes); |
+ } finally { |
+ _appendingBounds = false; |
+ } |
+ } |
+ } |
+ |
@override |
- bool operator ==(Object object) => |
- object is TypeParameterTypeImpl && (element == object.element); |
+ bool operator ==(Object other) { |
+ if (other is TypeParameterTypeImpl && element == other.element) { |
+ if (_comparingBounds) { |
+ // If we're comparing bounds already, then we only need type variable |
+ // equality. |
+ return true; |
+ } |
+ _comparingBounds = true; |
+ try { |
+ return bound == other.bound; |
+ } finally { |
+ _comparingBounds = false; |
+ } |
+ } |
+ return false; |
+ } |
+ |
+ static bool _comparingBounds = false; |
+ static bool _appendingBounds = false; |
@override |
bool isMoreSpecificThan(DartType s, |