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

Side by Side Diff: tests/compiler/dart2js_extra/constant_javascript_semantics_test.dart

Issue 10909119: Big doubles are now integers too. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Make sure we use JavaScript semantics when compiling compile-time constants. 5 // Make sure we use JavaScript semantics when compiling compile-time constants.
6 6
7 const x = 12345678901234567891; 7 const x = 12345678901234567891;
8 const y = 12345678901234567890; 8 const y = 12345678901234567890;
9 const z = x - y; 9 const z = x - y;
10 10
11 const a = 1.0; 11 const a = 1.0;
12 const b = a << 3; // This would not be valid with Dart semantics. 12 const b = a << 3; // This would not be valid with Dart semantics.
13 13
14 const c = -0.0; 14 const c = -0.0;
15 const d = c << 1; // This would not be valid with Dart semantics. 15 const d = c << 1; // This would not be valid with Dart semantics.
16 16
17 foo() => 12345678901234567891 - 12345678901234567890; 17 foo() => 12345678901234567891 - 12345678901234567890;
18 18
19 main() { 19 main() {
20 Expect.equals(0, z); 20 Expect.equals(0, z);
21 Expect.equals(0, x - y); 21 Expect.equals(0, x - y);
22 Expect.equals(0, foo()); 22 Expect.equals(0, foo());
23 Expect.isTrue(x is double); 23 Expect.isTrue(x is double);
24 // TODO(floitsch): we probably want to change this to be true. 24 Expect.isTrue(x is int);
25 Expect.isFalse(x is int);
26 Expect.equals(8, b); 25 Expect.equals(8, b);
27 Expect.equals(8, 1.0 << 3); // This would not be valid with Dart semantics. 26 Expect.equals(8, 1.0 << 3); // This would not be valid with Dart semantics.
28 Expect.isTrue(1 == 1.0); 27 Expect.isTrue(1 == 1.0);
29 Expect.equals(0, d); 28 Expect.equals(0, d);
30 Expect.equals(0, -0.0 << 1); // This would not be valid with Dart semantics. 29 Expect.equals(0, -0.0 << 1); // This would not be valid with Dart semantics.
31 // Make sure the 1 is not shifted into the 32 bit range. 30 // Make sure the 1 is not shifted into the 32 bit range.
32 Expect.equals(0, 0x100000000 >> 3); 31 Expect.equals(0, 0x100000000 >> 3);
33 // The dynamic int-check also allows -0.0. 32 // The dynamic int-check also allows -0.0.
34 Expect.isTrue((-0.0) is int); 33 Expect.isTrue((-0.0) is int);
35 } 34 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698