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

Side by Side Diff: tests/language_strong/const_error_multiply_initialized_test.dart

Issue 2765693002: Update all tests (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // If a constant constructor contains an initializer, or an initializing 5 // If a constant constructor contains an initializer, or an initializing
6 // formal, for a final field which itself has an initializer at its 6 // formal, for a final field which itself has an initializer at its
7 // declaration, then a runtime error should occur if that constructor is 7 // declaration, then a runtime error should occur if that constructor is
8 // invoked using "new", but there should be no compile-time error. However, if 8 // invoked using "new", but there should be no compile-time error. However, if
9 // the constructor is invoked using "const", there should be a compile-time 9 // the constructor is invoked using "const", there should be a compile-time
10 // error, since it is a compile-time error for evaluation of a constant object 10 // error, since it is a compile-time error for evaluation of a constant object
11 // to result in an uncaught exception. 11 // to result in an uncaught exception.
12 12
13 import "package:expect/expect.dart"; 13 import "package:expect/expect.dart";
14 14
15 class C { 15 class C {
16 final x = 1; 16 final x = 1;
17 const C() : x = 2; /// 01: compile-time error 17 const C() : x = 2; //# 01: compile-time error
18 const C() : x = 2; /// 02: static type warning 18 const C() : x = 2; //# 02: static type warning
19 const C(this.x); /// 03: compile-time error 19 const C(this.x); //# 03: compile-time error
20 const C(this.x); /// 04: static type warning 20 const C(this.x); //# 04: static type warning
21 } 21 }
22 22
23 main() { 23 main() {
24 const C(); /// 01: continued 24 const C(); //# 01: continued
25 Expect.throws(() => new C()); /// 02: continued 25 Expect.throws(() => new C()); //# 02: continued
26 const C(2); /// 03: continued 26 const C(2); //# 03: continued
27 Expect.throws(() => new C(2)); /// 04: continued 27 Expect.throws(() => new C(2)); //# 04: continued
28 } 28 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698