Skip to content

Specify callable object closurization #1842

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

Merged
merged 6 commits into from
Sep 3, 2021

Conversation

eernstg
Copy link
Member

@eernstg eernstg commented Sep 3, 2021

This PR adds a new case to the set of possible 'property extraction' expressions: Implicit property extraction. It occurs where an expression e has a static type as a callable object, and the context type is a function type. In this case we desugar e into e.call. Note that this will also serve as the first step in a generic function instantiation, because it is still true that the context type is a function type also in the case where e.call isn't assignable to that context type (but we can fix it by means of an implicit instantiation).

Smaller corrections:

The subsubsection about generic function instantiation was turned into a subsection: It used to be the case that a generic function instantiation would necessarily include a function closurization as a sub-action. This is no longer true, we can perform the generic instantiation on an existing function object. This means that the generic instantiation material should no longer be a subsection of 'Function Closurization', it's a stand-alone feature.

Subtitle uses version 2.15-dev, not 2.13-dev.

Note that this change is not expected to give rise to any implementation efforts. The following works today already:

class A { call() {}}
void f(void Function() g) => print(g);
void main() => f(A());

@eernstg eernstg requested a review from lrhn September 3, 2021 12:50
@google-cla google-cla bot added the cla: yes label Sep 3, 2021
@github-actions
Copy link

github-actions bot commented Sep 3, 2021

Visit the preview URL for this PR (updated for commit 6d97e4a):

https://dart-specification--pr1842-specify-callable-clo-tdx7351j.web.app

(expires Fri, 10 Sep 2021 13:52:10 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 6941ecd630c4f067ff3d02708a45ae0f0a42b88a

@eernstg eernstg merged commit 3e3ed49 into master Sep 3, 2021
@eernstg eernstg deleted the specify_callable_closurization_sep21 branch September 3, 2021 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants