OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
eernst
2017/09/04 17:04:56
Lost coverage: don't delete this file.
| |
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. | |
4 // Check that type of the AssertAssignable is recomputed correctly. | |
5 // VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-co mpilation | |
6 | |
7 import "package:expect/expect.dart"; | |
8 | |
9 class A { | |
10 final p; | |
11 final _b; | |
12 | |
13 b() { | |
14 try { | |
15 return _b; | |
16 } catch (e) {} | |
17 } | |
18 | |
19 A(this.p, this._b); | |
20 } | |
21 | |
22 class B extends A { | |
23 B(p, b) : super(p, b); | |
24 } | |
25 | |
26 bar(v) { | |
27 for (var x = v; x != null; x = x.p) { | |
28 if (x.b()) { | |
29 return x; | |
30 } | |
31 } | |
32 return null; | |
33 } | |
34 | |
35 foo(v) { | |
36 A x = bar(v); | |
37 return x != null; | |
38 } | |
39 | |
40 main() { | |
41 final a = new A(new B(new A("haha", true), false), false); | |
42 | |
43 for (var i = 0; i < 20; i++) { | |
44 Expect.isTrue(foo(a)); | |
45 } | |
46 Expect.isTrue(foo(a)); | |
47 } | |
OLD | NEW |