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

Side by Side Diff: tests/standalone/javascript_compatibility_errors_test.dart

Issue 312693008: Add javascript compatibility warnings for strings that are not identical, but (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 | « runtime/vm/parser.cc ('k') | tests/standalone/javascript_compatibility_warnings_test.dart » ('j') | 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) 2014, the Dart project authors. Please see the AUTHORS file 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 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 // VMOptions=--warn_on_javascript_compatibility --warning_as_error --optimizatio n_counter_threshold=5 5 // VMOptions=--warn_on_javascript_compatibility --warning_as_error --optimizatio n_counter_threshold=5
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 8
9 f(x, y) { 9 f(x, y) {
10 // Unoptimized code. 10 // Unoptimized code.
(...skipping 17 matching lines...) Expand all
28 28
29 "${1.0}"; /// 20: compile-time error 29 "${1.0}"; /// 20: compile-time error
30 var z = "${1.0}"; /// 21: compile-time error 30 var z = "${1.0}"; /// 21: compile-time error
31 (1.0).toString(); /// 22: ok 31 (1.0).toString(); /// 22: ok
32 var z = (1.0).toString(); /// 23: ok 32 var z = (1.0).toString(); /// 23: ok
33 "$y"; /// 24: ok 33 "$y"; /// 24: ok
34 var z = "$y"; /// 25: ok 34 var z = "$y"; /// 25: ok
35 y.toString(); /// 26: ok 35 y.toString(); /// 26: ok
36 var z = y.toString(); /// 27: ok 36 var z = y.toString(); /// 27: ok
37 37
38 var a = "yz";
39 var b = "xyz";
40 b = b.substring(1);
41 if (identical(a, b)) { } /// 28: ok
42
38 if (x > 10) { 43 if (x > 10) {
39 // Optimized code. 44 // Optimized code.
40 x is double; /// 30: ok 45 x is double; /// 30: ok
41 if (x is double) { } /// 31: ok 46 if (x is double) { } /// 31: ok
42 try { x as double; } on CastError catch (e) { } /// 32: ok 47 try { x as double; } on CastError catch (e) { } /// 32: ok
43 try { var z = x as double; } on CastError catch (e) { } /// 33: ok 48 try { var z = x as double; } on CastError catch (e) { } /// 33: ok
44 y is int; /// 34: ok 49 y is int; /// 34: ok
45 if (y is int) { } /// 35: ok 50 if (y is int) { } /// 35: ok
46 try { y as int; } on CastError catch (e) { } /// 36: ok 51 try { y as int; } on CastError catch (e) { } /// 36: ok
47 try { var z = y as int; } on CastError catch (e) { } /// 37: ok 52 try { var z = y as int; } on CastError catch (e) { } /// 37: ok
48 53
49 "${1.0}"; /// 40: compile-time error 54 "${1.0}"; /// 40: compile-time error
50 var z = "${1.0}"; /// 41: compile-time error 55 var z = "${1.0}"; /// 41: compile-time error
51 (1.0).toString(); /// 42: ok 56 (1.0).toString(); /// 42: ok
52 var z = (1.0).toString(); /// 43: ok 57 var z = (1.0).toString(); /// 43: ok
53 "$y"; /// 44: ok 58 "$y"; /// 44: ok
54 var z = "$y"; /// 45: ok 59 var z = "$y"; /// 45: ok
55 y.toString(); /// 46: ok 60 y.toString(); /// 46: ok
56 var z = y.toString(); /// 47: ok 61 var z = y.toString(); /// 47: ok
62
63 var a = "yz";
64 var b = "xyz";
65 b = b.substring(1);
66 if (identical(a, b)) { } /// 48: ok
57 } 67 }
58 } 68 }
59 69
60 k(x, y) { 70 k(x, y) {
61 // Unoptimized code. 71 // Unoptimized code.
62 1.5 is double; 72 1.5 is double;
63 if (1.5 is double) { x++; } 73 if (1.5 is double) { x++; }
64 try { 1.5 as double; } on CastError catch (e) { } 74 try { 1.5 as double; } on CastError catch (e) { }
65 try { var y = 1.5 as double; } on CastError catch (e) { } 75 try { var y = 1.5 as double; } on CastError catch (e) { }
66 1.5 is int; 76 1.5 is int;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 }, 146 },
137 isJavascriptCompatibilityError); 147 isJavascriptCompatibilityError);
138 148
139 // No warnings (errors) should be issued after this point. 149 // No warnings (errors) should be issued after this point.
140 for (var i = 0; i < 20; i++) { 150 for (var i = 0; i < 20; i++) {
141 k(i * 1.0, i); 151 k(i * 1.0, i);
142 k(i * 1.0, i + 0.5); 152 k(i * 1.0, i + 0.5);
143 } 153 }
144 } 154 }
145 155
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | tests/standalone/javascript_compatibility_warnings_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698