| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 import "package:expect/expect.dart"; | |
| 6 | |
| 7 int globalCounter = 0; | |
| 8 | |
| 9 bool nonInlinedNumTypeCheck(Object object) { | |
| 10 if (new DateTime.now().millisecondsSinceEpoch == 42) { | |
| 11 return nonInlinedNumTypeCheck(object); | |
| 12 } | |
| 13 return object is num; | |
| 14 } | |
| 15 | |
| 16 int confuse(x) { | |
| 17 if (new DateTime.now().millisecondsSinceEpoch == 42) return confuse(x - 1); | |
| 18 return x; | |
| 19 } | |
| 20 | |
| 21 main() { | |
| 22 var o = [ "foo", 499 ][confuse(0)]; | |
| 23 | |
| 24 // When the lhs of a logical or fails, it must not assume that all negative is | |
| 25 // checks in it, have failed. | |
| 26 // Here, the `o is! num` check succeeds, but the length test failed. | |
| 27 if ((o is! num && o.length == 4) || | |
| 28 (nonInlinedNumTypeCheck(o))) { | |
| 29 Expect.fail("Type-check failed"); | |
| 30 } | |
| 31 } | |
| OLD | NEW |