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

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

Issue 1239513005: Switch on null-aware operators by default in analyzer. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // Verify semantics of the ?. operator when it appears in a postincrement or 5 // Verify semantics of the ?. operator when it appears in a postincrement or
6 // preincrement expression (or a postdecrement or predecrement expression). 6 // preincrement expression (or a postdecrement or predecrement expression).
7 7
8 // SharedOptions=--enable-null-aware-operators
9
10 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
11 9
12 class C { 10 class C {
13 int v; 11 int v;
14 C(this.v); 12 C(this.v);
15 static var staticField; 13 static var staticField;
16 } 14 }
17 15
18 class D { 16 class D {
19 E v; 17 E v;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 { D d = new D(new E()); H h = ++d?.v; Expect.identical(d.v, h); } /// 12: stat ic type warning 63 { D d = new D(new E()); H h = ++d?.v; Expect.identical(d.v, h); } /// 12: stat ic type warning
66 64
67 // --e1?.v is equivalent to e1?.v += 1. 65 // --e1?.v is equivalent to e1?.v += 1.
68 Expect.equals(null, --nullC()?.v); /// 13: ok 66 Expect.equals(null, --nullC()?.v); /// 13: ok
69 { C c = new C(1); Expect.equals(0, --c?.v); Expect.equals(0, c.v); } /// 14: o k 67 { C c = new C(1); Expect.equals(0, --c?.v); Expect.equals(0, c.v); } /// 14: o k
70 68
71 // The static type of --e1?.v is the same as the static type of e1.v - 1. 69 // The static type of --e1?.v is the same as the static type of e1.v - 1.
72 { D d = new D(new E()); F f = --d?.v; Expect.identical(d.v, f); } /// 15: ok 70 { D d = new D(new E()); F f = --d?.v; Expect.identical(d.v, f); } /// 15: ok
73 { D d = new D(new E()); H h = --d?.v; Expect.identical(d.v, h); } /// 16: stat ic type warning 71 { D d = new D(new E()); H h = --d?.v; Expect.identical(d.v, h); } /// 16: stat ic type warning
74 } 72 }
OLDNEW
« no previous file with comments | « tests/language/conditional_property_assignment_test.dart ('k') | tests/language/if_null_assignment_behavior_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698