Index: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java |
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java |
index 28953a5822333b3a1eae72ffc2ee91bd3cfb343e..bff4a1b251f43fa1ba07c213da2f2a1f1245fde7 100644 |
--- a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java |
+++ b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java |
@@ -11,6 +11,7 @@ import com.google.dart.compiler.ErrorCode; |
import com.google.dart.compiler.ast.DartClass; |
import com.google.dart.compiler.testing.TestCompilerContext; |
import com.google.dart.compiler.testing.TestCompilerContext.EventKind; |
+import com.google.dart.compiler.type.DynamicType; |
import com.google.dart.compiler.type.InterfaceType; |
import com.google.dart.compiler.type.Type; |
import com.google.dart.compiler.type.Types; |
@@ -535,4 +536,21 @@ public class ResolverTest extends ResolverTestCase { |
"}"), |
DartCompilerErrorCode.NO_SUCH_TYPE); |
} |
+ |
+ /** |
+ * When {@link SupertypeResolver} can not find "UnknownA", it uses {@link DynamicType}, which |
+ * returns {@link DynamicElement}. By itself, this is OK. However when we later try to resolve |
+ * second unknown type "UnknownB", we expect in {@link Elements#findElement()} specific |
+ * {@link ClassElement} implementation and {@link DynamicElement} is not valid. |
+ */ |
+ public void test_classDynamicElement_fieldDynamicElement() throws Exception { |
+ resolveAndTest(Joiner.on("\n").join( |
+ "class Object {}", |
+ "class MyClass implements UnknownA {", |
+ " UnknownB field;", |
+ "}"), |
+ DartCompilerErrorCode.NO_SUCH_TYPE, |
+ DartCompilerErrorCode.NOT_A_CLASS_OR_INTERFACE, |
+ DartCompilerErrorCode.NO_SUCH_TYPE); |
+ } |
} |