blob: 9e0b8fa9dd8c4fb95c318840b02e3dae65034ac4 [file] [log] [blame]
part of Expect;
typedef F<X> = void Function<Y extends X>();
typedef expected_target = Function<X>();
// Functions for correct type comparison in language feature tests
F<X> toF<X>(X x) => <Y extends X>() {};
Type typeOf<X>() => X;
// Function to check nnbd_top_merge feature
class CHECK_TOP_MERGE<T> {
T Function(T) get f => (x) => x;
}
// Functions to check least and greatest closures
// See https://github.com/dart-lang/co19/issues/575#issuecomment-613542349
Type? _capturedTypeArgument;
X captureTypeArgument<X>() {
_capturedTypeArgument = X;
throw "Error";
}
Type? get capturedTypeArgument {
var result = _capturedTypeArgument;
_capturedTypeArgument = null;
return result;
}
// Sound/Unsound null safety flags (formerly known as weak/strong mode)
bool get hasUnsoundNullSafety => const <Null>[] is List<Object>;
bool get hasSoundNullSafety => !hasUnsoundNullSafety;