Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: tests/language/logical_expression3_test.dart

Issue 183373003: Revert "Fix bad type-inferrence for logical expressions." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « tests/language/logical_expression2_test.dart ('k') | tests/language/logical_expression4_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698