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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java

Issue 26888007: Propagate type arguments into type variable bounds. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
index 107e6c8e6d4b2978f7242383f6c87757385091f8..587e5876114ffae4cebded483af59428b6bdb6b3 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
@@ -4527,18 +4527,23 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
if (node.getTypeArguments() == null) {
return false;
}
- TypeParameterElement[] boundingElts = null;
+ // prepare Type
Type type = node.getType();
if (type == null) {
return false;
}
+ // prepare ClassElement
Element element = type.getElement();
- if (element instanceof ClassElement) {
- boundingElts = ((ClassElement) element).getTypeParameters();
- } else {
+ if (!(element instanceof ClassElement)) {
return false;
}
+ ClassElement classElement = (ClassElement) element;
+ // prepare type parameters
+ Type[] typeParameters = classElement.getType().getTypeArguments();
+ TypeParameterElement[] boundingElts = classElement.getTypeParameters();
+ // iterate over each bounded type parameter and corresponding argument
NodeList<TypeName> typeNameArgList = node.getTypeArguments().getArguments();
+ Type[] typeArguments = ((InterfaceType) type).getTypeArguments();
int loopThroughIndex = Math.min(typeNameArgList.size(), boundingElts.length);
boolean foundError = false;
for (int i = 0; i < loopThroughIndex; i++) {
@@ -4546,6 +4551,7 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
Type argType = argTypeName.getType();
Type boundType = boundingElts[i].getBound();
if (argType != null && boundType != null) {
+ boundType = boundType.substitute(typeArguments, typeParameters);
if (!argType.isSubtypeOf(boundType)) {
ErrorCode errorCode;
if (isInConstConstructorInvocation(node)) {

Powered by Google App Engine
This is Rietveld 408576698