// 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.
///
/// @description Checks that the equality properties of any function object
/// obtained by generic function instantiation is determined by the equality of
/// the source function objects
/// @author sgrekhov@unipro.ru
/// @issue 47317

import "../../Utils/expect.dart";

main() {
  X localFunction1<X>(X x) => x;
  X localFunction2<X>(X x) => x;
  <X>() {
    var f1_1 = localFunction1;
    var f1_2 = localFunction1;

    var f1_3 = localFunction1<X>;
    var f1_4 = localFunction1<X>;
    X Function(X) f1_5 = localFunction1;
    var f2 = localFunction2<X>;

    Expect.equals(f1_1 == f1_2, f1_3 == f1_4);
    Expect.equals(f1_1 == f1_2, f1_3 == f1_5);
    Expect.notEquals(f1_3, f2);
    Expect.notEquals(f1_4, f2);
    Expect.notEquals(f1_5, f2);
  }<int>();
}
