blob: 0e4c7b906b6fd53a0d192e73e8bf199831d3157f [file] [log] [blame]
// Copyright (c) 2019, 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 A generic type alias is a declaration [D] of one of the following
/// forms:
/// S0 Function(T1, . . . , Tn, [Tn+1, . . . , Tn+k])
/// S0 Function(T1, . . . , Tn, {Tn+1 xn+1, . . . , Tn+k xn+k})
/// ...
/// [D] introduces a mapping from actual type argument lists to types.
/// @description Checks that [D] maps argument list to correct types
/// @Issue 41939, 42433
/// @author iarkh@unipro.ru
import "../../Utils/expect.dart";
class X {}
class Y extends X {}
void checkme1<T>(expected, [T? t]) {
Expect.equals(expected, T);
}
void checkme2<T extends X>(expected, [T? t]) {
Expect.equals(expected, T);
}
void checkme3<T extends Y>(expected, [T? t]) {
Expect.equals(expected, T);
}
typedef void Test1<T>(dynamic, [T? t]);
typedef void Test2<T extends X>(dynamic, [T? t]);
main() {
Test1 t1 = checkme1;
t1(Object, dynamic);
t1(Object);
Test1<X> t2 = checkme2;
t2(X, X());
t2(X);
Test1<Y> t3 = checkme3;
t3(Y, Y());
t3(Y);
Test2 t4 = checkme1;
t4(X, X());
t4(X);
Test2 t5 = checkme2;
t5(X, X());
t5(X);
Test2 t6 = checkme2;
t6(X, Y());
t6(X);
}