blob: 6eb5240ecb7755b41b93e109b7a04132b1d0068e [file] [log] [blame] [edit]
// Copyright (c) 2023, 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.
// Verifies that both nullability of type and type argument
// is taken into account in the FutureOr type checks.
// Regression test for https://github.com/dart-lang/sdk/issues/52536.
import 'dart:async';
import 'package:expect/expect.dart';
class C<D, T> {
final FutureOr<T> Function(D) fn;
C(this.fn);
}
FutureOr<T>? compute<T extends Object>(int? a) => null;
void main() {
final c = C<int?, int?>(compute);
c.fn(42);
Expect.isTrue(<FutureOr<int>?>[] is List<FutureOr<int?>>);
Expect.isFalse(
hasSoundNullSafety && <FutureOr<int?>>[] is List<FutureOr<int>?>,
);
}