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

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

Issue 262253002: Add flag to AnalysisOptions to be able to disable deferred loading. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase with bleeding_edge, updated status files not to break build 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 5154738c5dd16af1502cb9ec4a471fe181bb1ade..843177bb0c5324e5140155da5fe307991d7668c4 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
@@ -30,35 +30,450 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void fail_constDeferredClass() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "class A {",
+ " const A();",
+ "}"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "main() {",
+ " const a.A();",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.CONST_DEFERRED_CLASS);
+ verify(source);
+ }
+
+ public void fail_constDeferredClass_namedConstructor() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "class A {",
+ " const A.b();",
+ "}"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "main() {",
+ " const a.A.b();",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.CONST_DEFERRED_CLASS);
+ verify(source);
+ }
+
public void fail_constEvalThrowsException() throws Exception { // Not compile-time constant
Source source = addSource(createSource(//
- "class C {",
- " const C();",
- "}",
- "f() { return const C(); }"));
+ "class C {",
+ " const C();",
+ "}",
+ "f() { return const C(); }"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION);
+ verify(source);
+ }
+
+ public void fail_constInitializedWithNonConstValueFromDeferredClass() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const V = 1;"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "const B = a.V;"));
+ resolve(source);
+ assertErrors(
+ source,
+ CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_constInitializedWithNonConstValueFromDeferredClass_nested() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const V = 1;"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "const B = a.V + 1;"));
+ resolve(source);
+ assertErrors(
+ source,
+ CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_extendsDeferredClass() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "class A {}"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "class B extends a.A {}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.EXTENDS_DEFERRED_CLASS);
+ verify(source);
+ }
+
+ public void fail_extendsDeferredClass_classTypeAlias() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "class A {}"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "class M {}",
+ "class C = a.A with M;"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.EXTENDS_DEFERRED_CLASS);
+ verify(source);
+ }
+
+ public void fail_implementsDeferredClass() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "class A {}"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "class B implements a.A {}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.IMPLEMENTS_DEFERRED_CLASS);
+ verify(source);
+ }
+
+ public void fail_implementsDeferredClass_classTypeAlias() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "class A {}"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "class B {}",
+ "class M {}",
+ "class C = B with M implements a.A;"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.IMPLEMENTS_DEFERRED_CLASS);
+ verify(source);
+ }
+
+ public void fail_invalidAnnotationFromDeferredLibrary() throws Exception {
+ // See test_invalidAnnotation_notConstantVariable
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "class V { const V(); }",
+ "const v = const V();"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "@a.v main () {}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_invalidAnnotationFromDeferredLibrary_constructor() throws Exception {
+ // See test_invalidAnnotation_notConstantVariable
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "class C { const C(); }"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "@a.C() main () {}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_invalidAnnotationFromDeferredLibrary_namedConstructor() throws Exception {
+ // See test_invalidAnnotation_notConstantVariable
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "class C { const C.name(); }"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "@a.C.name() main () {}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_mixinDeclaresConstructor() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " A() {}",
+ "}",
+ "class B extends Object mixin A {}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR);
+ verify(source);
+ }
+
+ public void fail_mixinDeferredClass() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "class A {}"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "class B extends Object with a.A {}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.MIXIN_DEFERRED_CLASS);
+ verify(source);
+ }
+
+ public void fail_mixinDeferredClass_classTypeAlias() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "class A {}"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "class B {}",
+ "class C = B with a.A;"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.MIXIN_DEFERRED_CLASS);
+ verify(source);
+ }
+
+ public void fail_mixinOfNonClass() throws Exception {
+ // TODO(brianwilkerson) Compare with MIXIN_WITH_NON_CLASS_SUPERCLASS.
+ Source source = addSource(createSource(//
+ "var A;",
+ "class B extends Object mixin A {}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.MIXIN_OF_NON_CLASS);
+ verify(source);
+ }
+
+ public void fail_nonConstantDefaultValueFromDeferredLibrary() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const V = 1;"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "f({x : a.V}) {}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_nonConstantDefaultValueFromDeferredLibrary_nested() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const V = 1;"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "f({x : a.V + 1}) {}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_nonConstCaseExpressionFromDeferredLibrary() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const int c = 1;"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "main (int p) {",
+ " switch (p) {",
+ " case a.c:",
+ " break;",
+ " }",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_nonConstCaseExpressionFromDeferredLibrary_nested() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const int c = 1;"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "main (int p) {",
+ " switch (p) {",
+ " case a.c + 1:",
+ " break;",
+ " }",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_nonConstListElementFromDeferredLibrary() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const int c = 1;"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "f() {",
+ " return const [a.c];",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_nonConstListElementFromDeferredLibrary_nested() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const int c = 1;"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "f() {",
+ " return const [a.c + 1];",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_nonConstMapKeyFromDeferredLibrary() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const int c = 1;"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "f() {",
+ " return const {a.c : 0};",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_nonConstMapKeyFromDeferredLibrary_nested() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const int c = 1;"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "f() {",
+ " return const {a.c + 1 : 0};",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_nonConstMapValueFromDeferredLibrary() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const int c = 1;"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "f() {",
+ " return const {'a' : a.c};",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_nonConstMapValueFromDeferredLibrary_nested() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const int c = 1;"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "f() {",
+ " return const {'a' : a.c + 1};",
+ "}"));
resolve(source);
- assertErrors(source, CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION);
+ assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY);
verify(source);
}
- public void fail_mixinDeclaresConstructor() throws Exception {
+ public void fail_nonConstValueInInitializerFromDeferredLibrary_field() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const int C = 1;"));
Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
"class A {",
- " A() {}",
- "}",
- "class B extends Object mixin A {}"));
+ " final int x;",
+ " const A() : x = a.C;",
+ "}"));
resolve(source);
- assertErrors(source, CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR);
+ assertErrors(
+ source,
+ CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY);
verify(source);
}
- public void fail_mixinOfNonClass() throws Exception {
- // TODO(brianwilkerson) Compare with MIXIN_WITH_NON_CLASS_SUPERCLASS.
+ public void fail_nonConstValueInInitializerFromDeferredLibrary_field_nested() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const int C = 1;"));
Source source = addSource(createSource(//
- "var A;",
- "class B extends Object mixin A {}"));
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "class A {",
+ " final int x;",
+ " const A() : x = a.C + 1;",
+ "}"));
resolve(source);
- assertErrors(source, CompileTimeErrorCode.MIXIN_OF_NON_CLASS);
+ assertErrors(
+ source,
+ CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_nonConstValueInInitializerFromDeferredLibrary_redirecting() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const int C = 1;"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "class A {",
+ " const A.named(p);",
+ " const A() : this.named(a.C);",
+ "}"));
+ resolve(source);
+ assertErrors(
+ source,
+ CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY);
+ verify(source);
+ }
+
+ public void fail_nonConstValueInInitializerFromDeferredLibrary_super() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "const int C = 1;"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as a;",
+ "class A {",
+ " const A(p);",
+ "}",
+ "class B extends A {",
+ " const B() : super(a.C);",
+ "}"));
+ resolve(source);
+ assertErrors(
+ source,
+ CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY);
verify(source);
}
@@ -91,6 +506,23 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void fail_sharedDeferredPrefix() throws Exception {
+ addNamedSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "f1() {}"));
+ addNamedSource("/lib2.dart", createSource(//
+ "library lib2;",
+ "f2() {}"));
+ Source source = addSource(createSource(//
+ "library root;",
+ "import 'lib1.dart' deferred as lib;",
+ "import 'lib2.dart' as lib;",
+ "main() { lib.f1(); lib.f2(); }"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.SHARED_DEFERRED_PREFIX);
+ verify(source);
+ }
+
public void fail_superInitializerInObject() throws Exception {
Source source = addSource(createSource(//
// TODO(brianwilkerson) Figure out how to mock Object
@@ -426,40 +858,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_constDeferredClass() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "class A {",
- " const A();",
- "}"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "main() {",
- " const a.A();",
- "}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.CONST_DEFERRED_CLASS);
- verify(source);
- }
-
- public void test_constDeferredClass_namedConstructor() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "class A {",
- " const A.b();",
- "}"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "main() {",
- " const a.A.b();",
- "}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.CONST_DEFERRED_CLASS);
- verify(source);
- }
-
public void test_constEval_newInstance_constConstructor() throws Exception {
Source source = addSource(createSource(//
"class A {",
@@ -626,36 +1024,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_constInitializedWithNonConstValueFromDeferredClass() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const V = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "const B = a.V;"));
- resolve(source);
- assertErrors(
- source,
- CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
- public void test_constInitializedWithNonConstValueFromDeferredClass_nested() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const V = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "const B = a.V + 1;"));
- resolve(source);
- assertErrors(
- source,
- CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
public void test_constInstanceField() throws Exception {
Source source = addSource(createSource(//
"class C {",
@@ -1143,33 +1511,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_extendsDeferredClass() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "class A {}"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "class B extends a.A {}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.EXTENDS_DEFERRED_CLASS);
- verify(source);
- }
-
- public void test_extendsDeferredClass_classTypeAlias() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "class A {}"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "class M {}",
- "class C = a.A with M;"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.EXTENDS_DEFERRED_CLASS);
- verify(source);
- }
-
public void test_extendsDisallowedClass_class_bool() throws Exception {
Source source = addSource(createSource(//
"class A extends bool {}"));
@@ -1548,34 +1889,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_implementsDeferredClass() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "class A {}"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "class B implements a.A {}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.IMPLEMENTS_DEFERRED_CLASS);
- verify(source);
- }
-
- public void test_implementsDeferredClass_classTypeAlias() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "class A {}"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "class B {}",
- "class M {}",
- "class C = B with M implements a.A;"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.IMPLEMENTS_DEFERRED_CLASS);
- verify(source);
- }
-
public void test_implementsDisallowedClass_class_bool() throws Exception {
Source source = addSource(createSource(//
"class A implements bool {}"));
@@ -2176,50 +2489,7 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
"main() {",
"}"));
resolve(source);
- assertErrors(source, CompileTimeErrorCode.INVALID_ANNOTATION);
- }
-
- public void test_invalidAnnotationFromDeferredLibrary() throws Exception {
- // See test_invalidAnnotation_notConstantVariable
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "class V { const V(); }",
- "const v = const V();"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "@a.v main () {}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
- public void test_invalidAnnotationFromDeferredLibrary_constructor() throws Exception {
- // See test_invalidAnnotation_notConstantVariable
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "class C { const C(); }"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "@a.C() main () {}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
- public void test_invalidAnnotationFromDeferredLibrary_namedConstructor() throws Exception {
- // See test_invalidAnnotation_notConstantVariable
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "class C { const C.name(); }"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "@a.C.name() main () {}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY);
- verify(source);
+ assertErrors(source, CompileTimeErrorCode.INVALID_ANNOTATION);
}
public void test_invalidConstructorName_notEnclosingClassName_defined() throws Exception {
@@ -2520,33 +2790,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_mixinDeferredClass() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "class A {}"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "class B extends Object with a.A {}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.MIXIN_DEFERRED_CLASS);
- verify(source);
- }
-
- public void test_mixinDeferredClass_classTypeAlias() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "class A {}"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "class B {}",
- "class C = B with a.A;"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.MIXIN_DEFERRED_CLASS);
- verify(source);
- }
-
public void test_mixinInheritsFromNotObject_classDeclaration_extends() throws Exception {
Source source = addSource(createSource(//
"class A {}",
@@ -2941,32 +3184,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_nonConstantDefaultValueFromDeferredLibrary() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const V = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "f({x : a.V}) {}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
- public void test_nonConstantDefaultValueFromDeferredLibrary_nested() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const V = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "f({x : a.V + 1}) {}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
public void test_nonConstCaseExpression() throws Exception {
Source source = addSource(createSource(//
"f(int p, int q) {",
@@ -2980,42 +3197,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_nonConstCaseExpressionFromDeferredLibrary() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const int c = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "main (int p) {",
- " switch (p) {",
- " case a.c:",
- " break;",
- " }",
- "}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
- public void test_nonConstCaseExpressionFromDeferredLibrary_nested() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const int c = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "main (int p) {",
- " switch (p) {",
- " case a.c + 1:",
- " break;",
- " }",
- "}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
public void test_nonConstListElement() throws Exception {
Source source = addSource(createSource(//
"f(a) {",
@@ -3026,36 +3207,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_nonConstListElementFromDeferredLibrary() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const int c = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "f() {",
- " return const [a.c];",
- "}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
- public void test_nonConstListElementFromDeferredLibrary_nested() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const int c = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "f() {",
- " return const [a.c + 1];",
- "}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
public void test_nonConstMapAsExpressionStatement_begin() throws Exception {
Source source = addSource(createSource(//
"f() {",
@@ -3086,36 +3237,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_nonConstMapKeyFromDeferredLibrary() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const int c = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "f() {",
- " return const {a.c : 0};",
- "}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
- public void test_nonConstMapKeyFromDeferredLibrary_nested() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const int c = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "f() {",
- " return const {a.c + 1 : 0};",
- "}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
public void test_nonConstMapValue() throws Exception {
Source source = addSource(createSource(//
"f(a) {",
@@ -3126,36 +3247,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_nonConstMapValueFromDeferredLibrary() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const int c = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "f() {",
- " return const {'a' : a.c};",
- "}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
- public void test_nonConstMapValueFromDeferredLibrary_nested() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const int c = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "f() {",
- " return const {'a' : a.c + 1};",
- "}"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
public void test_nonConstValueInInitializer_binary_notBool_left() throws Exception {
Source source = addSource(createSource(//
"class A {",
@@ -3244,80 +3335,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_nonConstValueInInitializerFromDeferredLibrary_field() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const int C = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "class A {",
- " final int x;",
- " const A() : x = a.C;",
- "}"));
- resolve(source);
- assertErrors(
- source,
- CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
- public void test_nonConstValueInInitializerFromDeferredLibrary_field_nested() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const int C = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "class A {",
- " final int x;",
- " const A() : x = a.C + 1;",
- "}"));
- resolve(source);
- assertErrors(
- source,
- CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
- public void test_nonConstValueInInitializerFromDeferredLibrary_redirecting() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const int C = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "class A {",
- " const A.named(p);",
- " const A() : this.named(a.C);",
- "}"));
- resolve(source);
- assertErrors(
- source,
- CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
- public void test_nonConstValueInInitializerFromDeferredLibrary_super() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "const int C = 1;"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as a;",
- "class A {",
- " const A(p);",
- "}",
- "class B extends A {",
- " const B() : super(a.C);",
- "}"));
- resolve(source);
- assertErrors(
- source,
- CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY);
- verify(source);
- }
-
public void test_nonGenerativeConstructor_explicit() throws Exception {
Source source = addSource(createSource(//
"class A {",
@@ -3861,23 +3878,6 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_sharedDeferredPrefix() throws Exception {
- addNamedSource("/lib1.dart", createSource(//
- "library lib1;",
- "f1() {}"));
- addNamedSource("/lib2.dart", createSource(//
- "library lib2;",
- "f2() {}"));
- Source source = addSource(createSource(//
- "library root;",
- "import 'lib1.dart' deferred as lib;",
- "import 'lib2.dart' as lib;",
- "main() { lib.f1(); lib.f2(); }"));
- resolve(source);
- assertErrors(source, CompileTimeErrorCode.SHARED_DEFERRED_PREFIX);
- verify(source);
- }
-
public void test_superInInvalidContext_binaryExpression() throws Exception {
Source source = addSource(createSource(//
"var v = super + 0;"));

Powered by Google App Engine
This is Rietveld 408576698