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

Unified Diff: tests/compiler/dart2js/js_spec_optimization_test.dart

Issue 2396323004: Bug fix - use type of input, not type of result, for throw-on-null check (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/ssa/nodes.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/js_spec_optimization_test.dart
diff --git a/tests/compiler/dart2js/js_spec_optimization_test.dart b/tests/compiler/dart2js/js_spec_optimization_test.dart
index 822175e7deff1806f78705b90437ebe630923f4c..4b5df368b2a399a44178ccd76488d0a8994c2da2 100644
--- a/tests/compiler/dart2js/js_spec_optimization_test.dart
+++ b/tests/compiler/dart2js/js_spec_optimization_test.dart
@@ -57,6 +57,33 @@ const String TEST_3 = r"""
}
""";
+const String TEST_4 = r"""
+ import 'dart:_foreign_helper';
+ main() {
+ var s = JS('String|Null', '"Hello"');
+ var s1 = JS('returns:String;depends:none;effects:none;throws:null(1)',
+ '#.toLowerCase()', s);
+ var s2 = JS('returns:String;depends:none;effects:none;throws:null(1)',
+ '#.toUpperCase()', s);
+
+ // present: 'erCase' - retained at least one call to guarantee exception.
+ }
+""";
+
+const String TEST_5 = r"""
+ import 'dart:_foreign_helper';
+ main() {
+ var s = JS('String', '"Hello"');
+ var s1 = JS('returns:String;depends:none;effects:none;throws:null(1)',
+ '#.toLowerCase()', s);
+ var s2 = JS('returns:String;depends:none;effects:none;throws:null(1)',
+ '#.toUpperCase()', s);
+
+ // absent: 'erCase' - neither call needs to be retained since there is no
+ // exception.
+ }
+""";
+
main() {
RegExp directivePattern = new RegExp(
// \1 \2 \3
@@ -90,5 +117,7 @@ main() {
check(TEST_1),
check(TEST_2),
check(TEST_3),
+ check(TEST_4),
+ check(TEST_5),
]));
}
« no previous file with comments | « pkg/compiler/lib/src/ssa/nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698