6b830c4428
Fixes https://github.com/dart-lang/sdk/issues/48035 TEST=spawn_generic_function_test Change-Id: I28d0ea9123bd31cb1aa288824c3c7688fc2ca8f1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232160 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Alexander Aprelev <aam@google.com>
46 lines
990 B
Dart
46 lines
990 B
Dart
// Copyright (c) 2022, 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.
|
|
//
|
|
// Tests that generic functions are spawned with correct type arguments
|
|
|
|
import 'dart:isolate';
|
|
import 'package:expect/expect.dart';
|
|
|
|
void func<T>(T o) {
|
|
print("$o:$T");
|
|
Expect.equals("int", "$T");
|
|
}
|
|
|
|
void call2(dynamic f) {
|
|
f(2);
|
|
}
|
|
|
|
void call4(dynamic f) {
|
|
f(4);
|
|
}
|
|
|
|
void main() async {
|
|
{
|
|
final rp = ReceivePort();
|
|
Isolate.spawn(func<int>, 1, onExit: rp.sendPort);
|
|
await rp.first;
|
|
}
|
|
{
|
|
final rp = ReceivePort();
|
|
Isolate.spawn(call2, func<int>, onExit: rp.sendPort);
|
|
await rp.first;
|
|
}
|
|
void Function(int) to = func;
|
|
{
|
|
final rp = ReceivePort();
|
|
Isolate.spawn(to, 3, onExit: rp.sendPort);
|
|
await rp.first;
|
|
}
|
|
{
|
|
final rp = ReceivePort();
|
|
Isolate.spawn(call4, to, onExit: rp.sendPort);
|
|
await rp.first;
|
|
}
|
|
}
|