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

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

Issue 14985013: Report CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: tweak 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 24090c330ac0f38bbc478e6e6602f5117fcfd90e..e71ac170a2024175e2516096edc068783e181e53 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
@@ -49,19 +49,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void fail_constWithUndefinedConstructor() throws Exception {
- Source source = addSource(createSource(//
- "class A {",
- " A(x) {}",
- "}",
- "f() {",
- " return const A(0);",
- "}"));
- resolve(source);
- assertErrors(CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR);
- verify(source);
- }
-
public void fail_duplicateDefinition() throws Exception {
Source source = addSource(createSource(//
"f() {",
@@ -969,6 +956,32 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_constWithUndefinedConstructor() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " const A();",
+ "}",
+ "f() {",
+ " return const A.noSuchConstructor();",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR);
+ // no verify(), 'noSuchConstructor' is not resolved
+ }
+
+ public void test_constWithUndefinedConstructorDefault() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " const A.name();",
+ "}",
+ "f() {",
+ " return const A();",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT);
+ verify(source);
+ }
+
public void test_defaultValueInFunctionTypeAlias() throws Exception {
Source source = addSource(createSource(//
"typedef F([x = 0]);"));

Powered by Google App Engine
This is Rietveld 408576698