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

Side by Side Diff: tests/language/compile_time_constant_checked2_test.dart

Issue 10916232: Implement checked mode for const constructors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 class A {
6 final int x;
7 const A.a1() : x = 'foo';
8 const A.a2(this.x);
9 const A.a3([this.x = 'foo']);
10 const A.a4(String this.x);
11 const A.a5(String x) : this.x = x;
12 const A.a6(int x) : this.x = x;
13 }
14
15 const a1 = const A.a1(); /// 01: compile-time error
16 const a2 = const A.a2('foo'); /// 02: compile-time error
17 const a3 = const A.a3(); /// 03: compile-time error
18 const a4 = const A.a4('foo'); /// 04: compile-time error
19 const a5 = const A.a5('foo'); /// 05: compile-time error
20 const a6 = const A.a6('foo'); /// 06: compile-time error
21
22 var b1 = const A.a1(); /// 07: compile-time error
23 var b2 = const A.a2('foo'); /// 08: compile-time error
24 var b3 = const A.a3(); /// 09: compile-time error
25 var b4 = const A.a4('foo'); /// 10: compile-time error
26 var b5 = const A.a5('foo'); /// 11: compile-time error
27 var b6 = const A.a6('foo'); /// 12: compile-time error
28
29 main() {
30 print(a1); /// 01: continued
31 print(a2); /// 02: continued
32 print(a3); /// 03: continued
33 print(a4); /// 04: continued
34 print(a5); /// 05: continued
35 print(a6); /// 06: continued
36
37 print(b1); /// 07: continued
38 print(b2); /// 08: continued
39 print(b3); /// 09: continued
40 print(b4); /// 10: continued
41 print(b5); /// 11: continued
42 print(b6); /// 12: continued
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698