blob: 9aeca7da768e54d54ec58be7f9191d837d41df38 [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 Test equality of function and methods tearoffs.
/// https://github.com/dart-lang/language/issues/1712
///
/// @description Checks equality of instantiated top level generic functions
/// @author sgrekhov@unipro.ru
// SharedOptions=--enable-experiment=constructor-tearoffs
import "../../Utils/expect.dart";
typedef X Foo<X>(X x);
X globalFunction<X>(X x) => x;
Foo getFoo() => globalFunction;
Foo<int> getIntFoo() => globalFunction<int>;
var g1 = getFoo();
var g2 = getFoo();
var ig1 = getIntFoo();
var ig2 = getIntFoo();
main() {
Expect.identical(g1, g2);
Expect.identical(ig1, ig2);
}