Skip to content

Commit 7408ed4

Browse files
eernstgcommit-bot@chromium.org
authored andcommitted
Added null-check selector to syntax of cascades, and test.
Change-Id: Iecfe33abaf440576127f9a2b536593328c906e12 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124332 Reviewed-by: Lasse R.H. Nielsen <lrn@google.com> Commit-Queue: Erik Ernst <eernst@google.com>
1 parent 6f70d7f commit 7408ed4

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) 2019, 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+
// SharedOptions=--enable-experiment=non-nullable
6+
7+
import "package:expect/expect.dart";
8+
9+
class C {
10+
int? y;
11+
D? f() => new D();
12+
C? h() => this;
13+
}
14+
15+
class D {
16+
D g() => this;
17+
bool? operator [](String s) => true;
18+
}
19+
20+
void test(C x) {
21+
x..f()!.g()['Hi!']!..h()!.y = 2;
22+
}
23+
24+
main() {
25+
test(new C());
26+
}

0 commit comments

Comments
 (0)