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