// 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); // Should work, gives error.

  // Checking it!
  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;

// 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;

Remove misleading comment from test
[cfe] Remove misleading comment from test

Change-Id: I97392718faf380d1431e76e808bbe775e25e3d4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177860
Reviewed-by: Dmitry Stefantsov <95a4b7e39916a54bd6477bec6a6de014b977db32@google.com>
Commit-Queue: Johnni Winther <0f64ef784d57ffb064b634040f9eeba0d33d0be4@google.com>
