Files
sdk/pkg/front_end/testcases/nnbd/issue_39286_2.dart
T
Dmitry Stefantsov 5af05598eb [cfe] Disallow non-nullable fields without initializers
Closes #40081.

Bug: http://dartbug.com/40081
Change-Id: I4032af18164af05034c2706cba8f62be39c636c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133994
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-02-03 13:32:45 +00:00

20 lines
440 B
Dart

// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// 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.
class C {
int y = 42;
D? f() => new D();
C h() => this;
}
class D {
D g() => this;
String operator [](String s) { return "!$s!";}
}
void test(C x) {
x..f()!.g()['Hi!']!..h()!.y = 2;
}
main() {
test(new C());
}