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

Unified Diff: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java

Issue 9186017: Fix crash in dartc when given cyclic type variable bounds. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated unit test Created 8 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: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java
index 4dc6348002c9da4cd93cbe6b1325edcde530e735..903e62d97402de3fb99be3079b76e24757f34d0c 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java
@@ -309,6 +309,29 @@ public class TypeAnalyzerTest extends TypeAnalyzerTestCase {
analyzeClass(classes.get("OptionalParameter"), 1);
}
+ public void testCyclicTypeVariable() {
+ Map<String, ClassElement> classes = loadSource(
+ "interface A<T> { }",
+ "typedef funcType<T>(T arg);",
+ "class B<T extends T> {}",
+ "class C<T extends A<T>> {}",
+ "class D<T extends funcType<T>> {}");
+ analyzeClasses(classes,
+ TypeErrorCode.CYCLIC_REFERENCE_TO_TYPE_VARIABLE,
+ TypeErrorCode.CYCLIC_REFERENCE_TO_TYPE_VARIABLE,
+ TypeErrorCode.CYCLIC_REFERENCE_TO_TYPE_VARIABLE);
+ ClassElement B = classes.get("B");
+ analyzeClass(B, 1);
+ assertEquals(1, B.getType().getArguments().size());
+ ClassElement C = classes.get("C");
+ analyzeClass(C, 1);
+ assertEquals(1, C.getType().getArguments().size());
+ ClassElement D = classes.get("D");
+ analyzeClass(D, 1);
+ assertEquals(1, D.getType().getArguments().size());
+
+ }
+
public void testDoWhileStatement() {
analyze("do {} while (true);");
analyze("do {} while (null);");

Powered by Google App Engine
This is Rietveld 408576698