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

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

Issue 14671018: Report CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Check if name is resolved not to the enclosing ClassElement Created 7 years, 7 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 9dd97a4ee2a83143aa905d1211be11ce571ea100..bf7cd60c3c1aaca17c10d281b022fa2b05907b98 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
@@ -121,15 +121,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void fail_invalidFactoryNameNotAClass() throws Exception {
- Source source = addSource(createSource(//
- // TODO
- ));
- resolve(source);
- assertErrors(CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS);
- verify(source);
- }
-
public void fail_invalidOverrideDefaultValue() throws Exception {
Source source = addSource(createSource(//
"class A {",
@@ -1448,6 +1439,27 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
// no verify() call, "B" is not resolved
}
+ public void test_invalidFactoryNameNotAClass_notClassName() throws Exception {
+ Source source = addSource(createSource(//
+ "int B;",
+ "class A {",
+ " factory B() {}",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS);
+ verify(source);
+ }
+
+ public void test_invalidFactoryNameNotAClass_notEnclosingClassName() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " factory B() {}",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS);
+ // no verify() call, "B" is not resolved
+ }
+
public void test_invalidOverrideNamed_fewerNamedParameters() throws Exception {
Source source = addSource(createSource(//
"class A {",

Powered by Google App Engine
This is Rietveld 408576698