Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 2655243007: Fix for invalid 'extends/implements/with SomeEnum'. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/dart/element/element.dart
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index ac89153aad898dedf55ba652363c2173151f5d83..c90c7c3b8f0a6b1846e33955b2158f2887a769ac 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -730,7 +730,7 @@ class ClassElementImpl extends AbstractClassElementImpl
ResynthesizerContext context = enclosingUnit.resynthesizerContext;
_interfaces = _unlinkedClass.interfaces
.map((EntityRef t) => context.resolveTypeRef(t, this))
- .where((DartType type) => type is InterfaceType)
+ .where(_isClassInterfaceType)
.toList(growable: false);
}
return _interfaces ?? const <InterfaceType>[];
@@ -837,7 +837,7 @@ class ClassElementImpl extends AbstractClassElementImpl
ResynthesizerContext context = enclosingUnit.resynthesizerContext;
_mixins = _unlinkedClass.mixins
.map((EntityRef t) => context.resolveTypeRef(t, this))
- .where((DartType type) => type is InterfaceType)
+ .where(_isClassInterfaceType)
.toList(growable: false);
}
return _mixins ?? const <InterfaceType>[];
@@ -871,7 +871,7 @@ class ClassElementImpl extends AbstractClassElementImpl
if (_unlinkedClass.supertype != null) {
DartType type = enclosingUnit.resynthesizerContext
.resolveTypeRef(_unlinkedClass.supertype, this);
- if (type is InterfaceType) {
+ if (_isClassInterfaceType(type)) {
_supertype = type;
} else {
_supertype = context.typeProvider.objectType;
@@ -1275,6 +1275,13 @@ class ClassElementImpl extends AbstractClassElementImpl
}
return false;
}
+
+ /**
+ * Return `true` if the given [type] is a class [InterfaceType].
+ */
+ static bool _isClassInterfaceType(DartType type) {
+ return type is InterfaceType && !type.element.isEnum;
Brian Wilkerson 2017/01/28 17:18:39 Personally, I'd rather have a method like this be
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698