mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:56:57 +00:00
5357052714
Fixes https://github.com/dart-lang/sdk/issues/40066 Change-Id: I90f74c8162e5a369e656666e98e0e427bb179822 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131200 Reviewed-by: Martin Kustermann <kustermann@google.com>
30 lines
689 B
Dart
30 lines
689 B
Dart
// Copyright (c) 2020, 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 "package:expect/expect.dart";
|
|
|
|
class A<T> {
|
|
foo(T x) {
|
|
print('T = $T');
|
|
print('x.runtimeType = ${x.runtimeType}');
|
|
print('x is T = ${x is T}');
|
|
}
|
|
}
|
|
|
|
typedef IntFunc = void Function(int);
|
|
typedef StringFunc = void Function(String);
|
|
|
|
void main() {
|
|
void inner<S>(S y) {}
|
|
|
|
IntFunc innerOfInt = inner;
|
|
A a = new A<IntFunc>();
|
|
a.foo(innerOfInt);
|
|
|
|
StringFunc innerOfString = inner;
|
|
Expect.throwsTypeError(() {
|
|
a.foo(innerOfString);
|
|
});
|
|
}
|