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

Unified Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java

Issue 47753002: Issue 14306. It is compile-time error to reference non-constructor in const redirecting constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix for review comment 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_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
index d54cab98d2efc727e58686ae4255e9145a21b145..7c5bdd1adb126d5bd42227fe166629e91936eb7f 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
@@ -3036,6 +3036,51 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_redirectToMissingConstructor_named() throws Exception {
+ Source source = addSource(createSource(//
+ "class A implements B{",
+ " A() {}",
+ "}",
+ "class B {",
+ " const factory B() = A.name;",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.REDIRECT_TO_MISSING_CONSTRUCTOR);
+ }
+
+ public void test_redirectToMissingConstructor_unnamed() throws Exception {
+ Source source = addSource(createSource(//
+ "class A implements B{",
+ " A.name() {}",
+ "}",
+ "class B {",
+ " const factory B() = A;",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.REDIRECT_TO_MISSING_CONSTRUCTOR);
+ }
+
+ public void test_redirectToNonClass_notAType() throws Exception {
+ Source source = addSource(createSource(//
+ "int A;",
+ "class B {",
+ " const factory B() = A;",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.REDIRECT_TO_NON_CLASS);
+ verify(source);
+ }
+
+ public void test_redirectToNonClass_undefinedIdentifier() throws Exception {
+ Source source = addSource(createSource(//
+ "class B {",
+ " const factory B() = A;",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.REDIRECT_TO_NON_CLASS);
+ verify(source);
+ }
+
public void test_redirectToNonConstConstructor() throws Exception {
Source source = addSource(createSource(//
"class A {",

Powered by Google App Engine
This is Rietveld 408576698