Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
leafpetersen opened this issue Mar 23, 2018 · 2 comments
Closed
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. customer-vm
Milestone

Comments

@leafpetersen
Copy link
Member

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);
}
@leafpetersen leafpetersen added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Mar 23, 2018
@sjindel-google sjindel-google added customer-vm P1 A high priority bug; for example, a single project is unusable or has many test failures labels Mar 23, 2018
@sjindel-google sjindel-google added this to the Dart2 Beta 3 milestone Mar 23, 2018
@sjindel-google
Copy link
Contributor

Jens, I believe you implemented this functionality in the constant evaluator. Can you investigate?

@leafpetersen
Copy link
Member Author

On reflection, I'm wrong about what should be the correct behavior above. The original code should have been rejected, see: #32415 .

I'll leave this as a VM bug in case you want to make the error message/failure mode more robust, but feel free to close it otherwise.

@dgrove dgrove removed the P1 A high priority bug; for example, a single project is unusable or has many test failures label Mar 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. customer-vm
Projects
None yet
Development

No branches or pull requests

4 participants