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

Side by Side Diff: tests/language/code_motion_crash_test.dart

Issue 3002573002: Migrating another batch of tests to dart 2. (Closed)
Patch Set: Removed library closure_type_test from test_file Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4
5 // Regression test for dart2js that used to crash during the
6 // [SsaCodeMotion] phase on this code.
7
8 class A {
9 final finalField;
10 var field = 2;
11 foo() {
12 new A().field = 42;
13 }
14
15 A._() : finalField = 42;
16 A() : finalField = [new A._(), new B(), new Object()][1];
17 }
18
19 class B {
20 foo() {}
21 bar() {}
22 }
23
24 main() {
25 var a = new A();
26 // Create a new block for SsaCodeMotion: the phase will want to move
27 // field access on [a] to this block.
28 if (true) {
29 var b = a.finalField;
30 var d = a.field;
31 b.bar();
32
33 // [c] gets GVN'ed with [b]. As a consequence, the type propagator
34 // that runs after GVN sees that [c] can only be a [B] because of
35 // the call to [bar].
36 var c = a.finalField;
37 c.foo();
38
39 // [e] does not get GVN'ed because the GVN phase sees [c.foo()] as
40 // having side effects.
41 var e = a.field;
42 if (d + e != 4) throw 'Test failed';
43 }
44 }
OLDNEW
« no previous file with comments | « tests/language/code_after_try_is_executed_test.dart ('k') | tests/language/comparison_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698