Files
sdk/pkg/front_end/testcases/nnbd/nullable_extension.dart
T
Johnni Winther 7f1f32904c [cfe] Handle extension on nullable type
.. when the property already exist for the non-nullable type.

Change-Id: Ic083de134ea73592de4d68fb3ecc06ddf8398d65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152331
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-01 07:27:28 +00:00

21 lines
474 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 A {
String text = "";
}
extension on A? {
String get text => "Lily was here";
}
void main() {
A? a = null;
expect("Lily was here", a.text);
}
expect(expected, actual) {
if (expected != actual) throw 'Expected $expected, actual $actual';
}