blob: ff9f514c015943e8a92279283fa5b161bdd9a219 [file] [log] [blame]
// Copyright (c) 2021, 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.
/// @assertion For the purposes of errors and warnings, the null aware operators
/// ?., ?.., and ?[] are checked as if the receiver of the operator had
/// non-nullable type. More specifically, if the type of the receiver of a null
/// aware operator is T, then the operator is checked as if the receiver had type
/// NonNull(T).
///
/// @description Check that if the type of the receiver of a null aware operator
/// is T, then the operator is checked as if the receiver had type NonNull(T).
/// Test FutureOr<A?> for some A
/// @issue 38715
/// @author sgrekhov@unipro.ru
// Requirements=nnbd-weak
import "dart:async";
class A {
void test() {}
int operator[](int index) => 0;
}
main() {
FutureOr<A?> a = null;
a?.toString();
a ?.. toString();
a = new A();
a?.toString();
a ?.. toString();
}