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

Unified Diff: tests/language/const_getter_test.dart

Issue 1512573002: Disallow const getters. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « pkg/compiler/lib/src/parser/parser.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/const_getter_test.dart
diff --git a/tests/language/regress_21998_1_test.dart b/tests/language/const_getter_test.dart
similarity index 56%
copy from tests/language/regress_21998_1_test.dart
copy to tests/language/const_getter_test.dart
index 3237f3396629f6fd11270e1adc290bec78713958..97717e89fae6f37d07666e6551804b3d63b998df 100644
--- a/tests/language/regress_21998_1_test.dart
+++ b/tests/language/const_getter_test.dart
@@ -2,17 +2,21 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:math' as Math;
+// Check that const getters are not allowed.
+
import 'package:expect/expect.dart';
-main() {
- Expect.equals(4, new C().m());
+class C {
+ const C();
+
+ const /// 01: compile-time error
+ get x => 1;
}
-class C {
- max(a) => a;
+const /// 02: compile-time error
+get y => 2;
- m() {
- return max(Math.max(2, 4));
- }
-}
+main() {
+ Expect.equals(1, const C().x);
+ Expect.equals(2, y);
+}
« no previous file with comments | « pkg/compiler/lib/src/parser/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698