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

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

Issue 272803002: Issue 18653. Report error for a const constructor in a class with a mixin. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 cacabf43ca072dd8ef0c2cbdd4b57c14409b3873..7639fbc7375b1d8bb08b33b37a94289a2490da89 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
@@ -360,6 +360,18 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_constConstructorWithMixin() throws Exception {
+ Source source = addSource(createSource(//
+ "class M {",
+ "}",
+ "class A extends Object with M {",
+ " const A();",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN);
+ verify(source);
+ }
+
public void test_constConstructorWithNonConstSuper_explicit() throws Exception {
Source source = addSource(createSource(//
"class A {",
@@ -395,7 +407,10 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
" const B();",
"}"));
resolve(source);
- assertErrors(source, CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD);
+ assertErrors(
+ source,
+ CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN,
+ CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD);
verify(source);
}
@@ -2210,6 +2225,16 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors(source, CompileTimeErrorCode.INVALID_ANNOTATION);
}
+ public void test_invalidAnnotation_useLibraryScope() throws Exception {
+ Source source = addSource(createSource(//
+ "@foo",
+ "class A {",
+ " static const foo = null;",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.INVALID_ANNOTATION);
+ }
+
public void test_invalidAnnotationFromDeferredLibrary() throws Exception {
// See test_invalidAnnotation_notConstantVariable
addNamedSource("/lib1.dart", createSource(//
@@ -2253,16 +2278,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_invalidAnnotation_useLibraryScope() throws Exception {
- Source source = addSource(createSource(//
- "@foo",
- "class A {",
- " static const foo = null;",
- "}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.INVALID_ANNOTATION);
- }
-
public void test_invalidConstructorName_notEnclosingClassName_defined() throws Exception {
Source source = addSource(createSource(//
"class A {",

Powered by Google App Engine
This is Rietveld 408576698