OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
6 import 'package:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; |
7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
8 | 8 |
9 import "deferred_constraints_constants_lib.dart" deferred as lib; | 9 import "deferred_constraints_constants_lib.dart" deferred as lib; |
10 | 10 |
11 const myConst1 = | 11 const myConst1 = |
12 lib.constantInstance; //# reference1: compile-time error | 12 lib.constantInstance; //# reference1: compile-time error |
13 /* // //# reference1: continued | 13 /* // //# reference1: continued |
14 499; | 14 499; |
15 */ // //# reference1: continued | 15 */ // //# reference1: continued |
16 const myConst2 = | 16 const myConst2 = |
17 lib.Const.instance; //# reference2: compile-time error | 17 lib.Const.instance; //# reference2: compile-time error |
18 /* // //# reference2: continued | 18 /* // //# reference2: continued |
19 499; | 19 499; |
20 */ // //# reference2: continued | 20 */ // //# reference2: continued |
21 | 21 |
22 void f1( | 22 void f1({a: |
23 {a: | |
24 const lib.Const() //# default_argument1: compile-time error | 23 const lib.Const() //# default_argument1: compile-time error |
25 /* // //# default_argument1: continued | 24 /* // //# default_argument1: continued |
26 499 | 25 499 |
27 */ // //# default_argument1: continued | 26 */ // //# default_argument1: continued |
28 }) {} | 27 }) {} |
29 | 28 |
30 void f2( | 29 void f2({a: |
31 {a: | |
32 lib.constantInstance //# default_argument2: compile-time error | 30 lib.constantInstance //# default_argument2: compile-time error |
33 /* // //# default_argument2: continued | 31 /* // //# default_argument2: continued |
34 499 | 32 499 |
35 */ // //# default_argument2: continued | 33 */ // //# default_argument2: continued |
36 }) {} | 34 }) {} |
37 | 35 |
38 @lib.Const() //# metadata1: compile-time error | 36 @lib.Const() //# metadata1: compile-time error |
39 class H1 {} | 37 class H1 {} |
40 | |
41 @lib.Const.instance //# metadata2: compile-time error | 38 @lib.Const.instance //# metadata2: compile-time error |
42 class H2 {} | 39 class H2 {} |
43 | |
44 @lib.Const.namedConstructor() //# metadata3: compile-time error | 40 @lib.Const.namedConstructor() //# metadata3: compile-time error |
45 class H3 {} | 41 class H3 {} |
46 | 42 |
47 void main() { | 43 void main() { |
48 var a1 = myConst1; | 44 var a1 = myConst1; |
49 var a2 = myConst2; | 45 var a2 = myConst2; |
50 | 46 |
51 asyncStart(); | 47 asyncStart(); |
52 lib.loadLibrary().then((_) { | 48 lib.loadLibrary().then((_) { |
53 var instance = lib.constantInstance; | 49 var instance = lib.constantInstance; |
54 var c1 = const lib.Const(); //# constructor1: compile-time error | 50 var c1 = const lib.Const(); //# constructor1: compile-time error |
55 var c2 = const lib.Const.namedConstructor(); //# constructor2: compile-time
error | 51 var c2 = const lib.Const.namedConstructor(); //# constructor2: compile-time
error |
56 f1(); | 52 f1(); |
57 f2(); | 53 f2(); |
58 var constInstance = lib.constantInstance; //# reference_after_load: ok | 54 var constInstance = lib.constantInstance; //# reference_after_load: ok |
59 var h1 = new H1(); | 55 var h1 = new H1(); |
60 var h2 = new H2(); | 56 var h2 = new H2(); |
61 var h3 = new H3(); | 57 var h3 = new H3(); |
62 | 58 |
63 // Need to access the metadata to trigger the expected compilation error. | 59 // Need to access the metadata to trigger the expected compilation error. |
64 reflectClass(H1).metadata; // metadata1: continued | 60 reflectClass(H1).metadata; // metadata1: continued |
65 reflectClass(H2).metadata; // metadata2: continued | 61 reflectClass(H2).metadata; // metadata2: continued |
66 reflectClass(H3).metadata; // metadata3: continued | 62 reflectClass(H3).metadata; // metadata3: continued |
67 | 63 |
68 asyncEnd(); | 64 asyncEnd(); |
69 }); | 65 }); |
70 } | 66 } |
| 67 |
OLD | NEW |