0fde98290e
Change-Id: I97392718faf380d1431e76e808bbe775e25e3d4e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177860 Reviewed-by: Dmitry Stefantsov <dmitryas@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
24 lines
611 B
Dart
24 lines
611 B
Dart
// 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.
|
|
|
|
import "dart:async";
|
|
|
|
T id<T>(T value) => value;
|
|
|
|
main() async {
|
|
FutureOr<int> x = 1 + id(1);
|
|
|
|
FutureOr<int> y = 1 + id(1)
|
|
..checkStaticType<Exactly<int>>();
|
|
FutureOr<int> z = 1 + contextType(1)
|
|
..checkStaticType<Exactly<int>>();
|
|
}
|
|
|
|
extension<T> on T {
|
|
void checkStaticType<R extends Exactly<T>>() {}
|
|
}
|
|
|
|
typedef Exactly<T> = T Function(T);
|
|
T contextType<T>(Object? o) => o as T;
|