OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Test that type inference sees the possible modification of `fisk` from | 5 // Test that type inference sees the possible modification of `fisk` from |
6 // the mirror system and not infers the value to be an integer, or any | 6 // the mirror system and not infers the value to be an integer, or any |
7 // other elements that use `fisk` like `otherFisk` to be of type integer. | 7 // other elements that use `fisk` like `otherFisk` to be of type integer. |
8 library test; | 8 library test; |
9 | 9 |
10 @MirrorsUsed(targets: 'fisk', override: '*') | 10 @MirrorsUsed(targets: 'fisk', override: '*') |
11 import 'dart:mirrors'; | 11 import 'dart:mirrors'; |
12 | 12 |
13 import 'package:expect/expect.dart'; | 13 import 'package:expect/expect.dart'; |
14 | 14 |
15 var fisk = 1; | 15 var fisk = 1; |
16 var otherFisk = 42; | 16 var otherFisk = 42; |
17 | 17 |
18 main() { | 18 main() { |
19 var lm = currentMirrorSystem().findLibrary(const Symbol('test')).single; | 19 var lm = currentMirrorSystem().findLibrary(const Symbol('test')); |
20 lm.setField(const Symbol('fisk'), 'hest'); | 20 lm.setField(const Symbol('fisk'), 'hest'); |
21 otherFisk = fisk; | 21 otherFisk = fisk; |
22 Expect.isTrue(otherFisk is String); | 22 Expect.isTrue(otherFisk is String); |
23 } | 23 } |
OLD | NEW |