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

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

Issue 10983089: Issue 3968. Report error if cycle in redirecting factory constructors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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/TypeAnalyzerCompilerTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
index ba575f15ecbd0f7f2ab2764e5f54c7011179b0bf..dd0d3e65c6daadaaa3b7bd95fcd463e7354b47b4 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -4794,6 +4794,26 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
}
}
+ public void test_redirectingFactoryConstructor_cycle() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " factory A.nameA() = C.nameC;",
+ "}",
+ "class B {",
+ " factory B.nameB() = A.nameA;",
+ "}",
+ "class C {",
+ " factory C.nameC() = B.nameB;",
+ "}",
+ ""));
+ assertErrors(
+ libraryResult.getErrors(),
+ errEx(ResolverErrorCode.REDIRECTION_CONSTRUCTOR_CYCLE, 3, 11, 7),
+ errEx(ResolverErrorCode.REDIRECTION_CONSTRUCTOR_CYCLE, 6, 11, 7),
+ errEx(ResolverErrorCode.REDIRECTION_CONSTRUCTOR_CYCLE, 9, 11, 7));
+ }
+
public void test_redirectingFactoryConstructor_notConst_fromConst() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode(
"// filler filler filler filler filler filler filler filler filler filler",

Powered by Google App Engine
This is Rietveld 408576698