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

Unified Diff: tests/compiler/dart2js_extra/if_null2_test.dart

Issue 1305663002: [dart2js] fix inference of ??= and []??= (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
Index: tests/compiler/dart2js_extra/if_null2_test.dart
diff --git a/tests/language/lazy_static7_test.dart b/tests/compiler/dart2js_extra/if_null2_test.dart
similarity index 55%
copy from tests/language/lazy_static7_test.dart
copy to tests/compiler/dart2js_extra/if_null2_test.dart
index ff74912259a11aa65a3e9499f4126300a07b489d..a9923a8e773ced622b04938b114e0f6f02b3cb33 100644
--- a/tests/language/lazy_static7_test.dart
+++ b/tests/compiler/dart2js_extra/if_null2_test.dart
@@ -2,15 +2,14 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import "package:expect/expect.dart";
+/// Regression for #24134: inference was not tracking ??= correctly.
+library tests.compiler.dart2js_extra.if_null2_test;
-var sideEffect = 0;
-var x = (() { sideEffect++; return 499; })();
+import "package:expect/expect.dart";
main() {
- if (new DateTime.now().day >= -1) {
- x = 42;
- }
- Expect.equals(42, x);
- Expect.equals(0, sideEffect);
+ var map;
+ map ??= {};
+ Expect.equals(0, map.length);
+ Expect.isTrue(map.length == 0);
}

Powered by Google App Engine
This is Rietveld 408576698