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

Unified Diff: pkg/analyzer/test/generated/compile_time_error_code_test.dart

Issue 1124733008: Remove const instance creation expressions from the dependency graph. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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: pkg/analyzer/test/generated/compile_time_error_code_test.dart
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index c365c9f90bfd8b613736c5b44e81a4448cc81d92..b9dc172f530bdad64a55d183d579e8dbf2169827 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -135,28 +135,6 @@ class B extends Object mixin A {}''');
verify([source]);
}
- void fail_recursiveCompileTimeConstant() {
- Source source = addSource(r'''
-class A {
- const A();
- final m = const A();
-}''');
- resolve(source);
- assertErrors(
- source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
- verify([source]);
- }
-
- void fail_recursiveCompileTimeConstant_cycle() {
- Source source = addSource(r'''
-const x = y + 1;
-const y = x + 1;''');
- resolve(source);
- assertErrors(
- source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
- verify([source]);
- }
-
void fail_superInitializerInObject() {
Source source = addSource(r'''
''');
@@ -857,8 +835,11 @@ int f() {
return 3;
}''');
resolve(source);
+ // TODO(paulberry): the error CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE is
+ // redundant and ought to be suppressed.
assertErrors(source, [
- CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST
+ CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST,
+ CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]);
verify([source]);
}
@@ -1368,8 +1349,10 @@ class A {
}
f(p) { return const A(p); }''');
resolve(source);
- assertErrors(
- source, [CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT]);
+ assertErrors(source, [
+ CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT,
+ CompileTimeErrorCode.INVALID_CONSTANT
Brian Wilkerson 2015/05/05 21:25:24 This new error (both here and below) also seems to
Paul Berry 2015/05/05 21:46:31 Agreed. I've added TODO comments.
+ ]);
verify([source]);
}
@@ -4380,8 +4363,10 @@ class B {
}
var b = const B();''');
resolve(source);
- assertErrors(
- source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
+ assertErrors(source, [
+ CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER,
+ CompileTimeErrorCode.INVALID_CONSTANT
+ ]);
verify([source]);
}
@@ -4658,6 +4643,44 @@ class A {
verify([source]);
}
+ void test_recursiveCompileTimeConstant() {
+ Source source = addSource(r'''
+class A {
+ const A();
+ final m = const A();
+}''');
+ resolve(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
+ verify([source]);
+ }
+
+ void test_recursiveCompileTimeConstant_cycle() {
+ Source source = addSource(r'''
+const x = y + 1;
+const y = x + 1;''');
+ resolve(source);
+ assertErrors(source, [
+ CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT,
+ CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT
+ ]);
+ verify([source]);
+ }
+
+ void test_recursiveCompileTimeConstant_initializer_after_toplevel_var() {
+ Source source = addSource('''
+const y = const C();
+class C {
+ const C() : x = y;
+ final x;
+}
+''');
+ resolve(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
+ verify([source]);
+ }
+
void test_recursiveConstructorRedirect() {
Source source = addSource(r'''
class A {

Powered by Google App Engine
This is Rietveld 408576698