Skip to content

[cfe] Does not apply call insertion in pattern declaration #51738

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
eernstg opened this issue Mar 15, 2023 · 2 comments
Closed

[cfe] Does not apply call insertion in pattern declaration #51738

eernstg opened this issue Mar 15, 2023 · 2 comments
Assignees
Labels
legacy-area-front-end Legacy: Use area-dart-model instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@eernstg
Copy link
Member

eernstg commented Mar 15, 2023

Consider the following program:

class A {
  X call<X>(X x) => x;
}

void g(A a) {
  var Function(call: f) = a;
  Function g = a; // This works.
}

The CFE (SDK 3.0.0-322.0.dev) reports a compile-time error for this program:

Error: The matched value of type 'A' isn't assignable to the required type 'Function'.
 - 'A' is from 'package:dartpad_sample/main.dart' ('lib/main.dart').
 - 'Function' is from 'dart:core'.
  var Function(call: f) = a;
      ^

However, I would expect this situation to give rise to a 'call insertion' coercion, that is, the initializing expression should have been transformed from a into a.call, based on the context type Function.

@eernstg eernstg added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) legacy-area-front-end Legacy: Use area-dart-model instead. labels Mar 15, 2023
@nshahan
Copy link
Contributor

nshahan commented Mar 23, 2023

cc @johnniwinther

I believe there is a related test failure because of a missing call method tearoff coercion in

language/patterns/call_tear_off_test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-front-end Legacy: Use area-dart-model instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants