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({a: | 22 void f1({a: |
23 const lib.Const() /// default_argument1: compile-time error | 23 const lib.Const() //# default_argument1: compile-time error |
24 /* /// default_argument1: continued | 24 /* //# default_argument1: continued |
25 499 | 25 499 |
26 */ /// default_argument1: continued | 26 */ //# default_argument1: continued |
27 }) {} | 27 }) {} |
28 | 28 |
29 void f2({a: | 29 void f2({a: |
30 lib.constantInstance /// default_argument2: compile-time error | 30 lib.constantInstance //# default_argument2: compile-time error |
31 /* /// default_argument2: continued | 31 /* //# default_argument2: continued |
32 499 | 32 499 |
33 */ /// default_argument2: continued | 33 */ //# default_argument2: continued |
34 }) {} | 34 }) {} |
35 | 35 |
36 @lib.Const() /// metadata1: compile-time error | 36 @lib.Const() //# metadata1: compile-time error |
37 class H1 {} | 37 class H1 {} |
38 @lib.Const.instance /// metadata2: compile-time error | 38 @lib.Const.instance //# metadata2: compile-time error |
39 class H2 {} | 39 class H2 {} |
40 @lib.Const.namedConstructor() /// metadata3: compile-time error | 40 @lib.Const.namedConstructor() //# metadata3: compile-time error |
41 class H3 {} | 41 class H3 {} |
42 | 42 |
43 void main() { | 43 void main() { |
44 var a1 = myConst1; | 44 var a1 = myConst1; |
45 var a2 = myConst2; | 45 var a2 = myConst2; |
46 | 46 |
47 asyncStart(); | 47 asyncStart(); |
48 lib.loadLibrary().then((_) { | 48 lib.loadLibrary().then((_) { |
49 var instance = lib.constantInstance; | 49 var instance = lib.constantInstance; |
50 var c1 = const lib.Const(); /// constructor1: compile-time error | 50 var c1 = const lib.Const(); //# constructor1: compile-time error |
51 var c2 = const lib.Const.namedConstructor(); /// constructor2: compile-time
error | 51 var c2 = const lib.Const.namedConstructor(); //# constructor2: compile-time
error |
52 f1(); | 52 f1(); |
53 f2(); | 53 f2(); |
54 var constInstance = lib.constantInstance; /// reference_after_load: ok | 54 var constInstance = lib.constantInstance; //# reference_after_load: ok |
55 var h1 = new H1(); | 55 var h1 = new H1(); |
56 var h2 = new H2(); | 56 var h2 = new H2(); |
57 var h3 = new H3(); | 57 var h3 = new H3(); |
58 | 58 |
59 // Need to access the metadata to trigger the expected compilation error. | 59 // Need to access the metadata to trigger the expected compilation error. |
60 reflectClass(H1).metadata; // metadata1: continued | 60 reflectClass(H1).metadata; // metadata1: continued |
61 reflectClass(H2).metadata; // metadata2: continued | 61 reflectClass(H2).metadata; // metadata2: continued |
62 reflectClass(H3).metadata; // metadata3: continued | 62 reflectClass(H3).metadata; // metadata3: continued |
63 | 63 |
64 asyncEnd(); | 64 asyncEnd(); |
65 }); | 65 }); |
66 } | 66 } |
67 | 67 |
OLD | NEW |