Skip to content

VM generic partial instantiation isn't kicking in on default arguments #32658

Closed
@leafpetersen

Description

@leafpetersen

The code below should print

(int) => void
(int) => void

and does so on ddc with kernel and ddc without kernel.

Run on the VM with --preview-dart-2, it prints the following:

(int) => void
Unhandled exception:
type '(T) => void' is not a subtype of type '(int) => void' of 'f'
#0      new A (file:///Users/leafp/tmp/ddctest.dart)
#1      main (file:///Users/leafp/tmp/ddctest.dart:13:13)
#2      _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:279:19)
#3      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)
typedef void Foo<T>(T x);

void foo<T>(T x) {}

class A<T> {
  Foo<T> f;
  A({this.f = foo});
}

main() {
  Foo<int> f = foo;
  print(f.runtimeType);
  print(new A<int>().f.runtimeType);
}

Metadata

Metadata

Assignees

Labels

area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.customer-vm

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions