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

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

Issue 18461006: Account for boolean operators shortcircuiting behavior (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Sync to head Created 7 years, 5 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 | « sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.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/cpa_inference_test.dart
diff --git a/tests/compiler/dart2js/cpa_inference_test.dart b/tests/compiler/dart2js/cpa_inference_test.dart
index d6e1a83fcbfad50bc177bd97b05ae5c2a1c24452..7d85b9a10230e30a1b48ed61936e7ff76360326b 100644
--- a/tests/compiler/dart2js/cpa_inference_test.dart
+++ b/tests/compiler/dart2js/cpa_inference_test.dart
@@ -887,6 +887,21 @@ testBooleanOperators() {
}
}
+testBooleanOperatorsShortCirtcuit() {
+ String source(op) {
+ return """
+ main() {
+ var x = null;
+ "foo" $op (x = 42);
+ x;
+ }""";
+ }
+ for (String op in ['&&', '||']) {
+ AnalysisResult result = analyze(source(op));
+ result.checkNodeHasType('x', [result.nullType, result.int]);
+ }
+}
+
testOperators() {
final String source = r"""
class A {
@@ -1553,6 +1568,7 @@ void main() {
// testNoReturn(); // right now we infer the empty type instead of null
testArithmeticOperators();
testBooleanOperators();
+ testBooleanOperatorsShortCirtcuit();
testOperators();
testCompoundOperators1();
testCompoundOperators2();
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698