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

Unified Diff: tests/language/const_constructor_nonconst_field_test.dart

Issue 397823004: Detect invalid const constructor due to non-const initializer in field declaration. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comment fix Created 6 years, 5 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: tests/language/const_constructor_nonconst_field_test.dart
diff --git a/tests/language/regress_12561_test.dart b/tests/language/const_constructor_nonconst_field_test.dart
similarity index 64%
copy from tests/language/regress_12561_test.dart
copy to tests/language/const_constructor_nonconst_field_test.dart
index 21acb0e51951407b03c3d35581944ac4029cb09f..9571a408a13a3cdf66626af502d090e26e512d3c 100644
--- a/tests/language/regress_12561_test.dart
+++ b/tests/language/const_constructor_nonconst_field_test.dart
@@ -4,12 +4,14 @@
import "package:expect/expect.dart";
-class C {
- noSuchMethod(int x, int y) => x + y;
+class A {
+ final int i = f(); /// 01: compile-time error
+ final int j = 1;
+ const A();
+}
+int f() {
+ return 3;
}
-
main() {
- Expect.throws(() => new C().foo, (e) => e is Error);
+ Expect.equals(const A().j, 1);
}
-
-

Powered by Google App Engine
This is Rietveld 408576698