-
Notifications
You must be signed in to change notification settings - Fork 214
Allow generic function instantiation of an existing function object #1812
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
Conversation
…on on an existing function object
@lrhn, I removed the review request because I'm revising this PR. I'll restore it when the text is stable again. |
The rules are now much more compositional (identical/== for the whole is determined by identical/== on the parts). Restored the review request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review response.
…on on the `call` of a function object
Added one change which was omitted by accident at first: The PR now also removes the rule which makes it an error to perform a generic method instantiation on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review response.
A few experiments with the current implementations show that we do actually allow for the tearoff. One might think "Sure, why not?", but we specified that it isn't possible, so I created #1827 to raise the question and perhaps decide that we should just support both the closurization and the generic function instantiation on an |
…ions This allows local variables and other expressions, as long as the static type is a generic function type, to be explicitly type instantiated. * Expressions with a non-generic function type cannot be type instantiated. * Expressions with a type of `Function` cannot be type instantiated. * Expressions with other non-function types cannot be type instantiated. This results in doubling-up of errors in a few situations. I think these are generally rare occurrences, and tricky to prevent double reporting, so I've left them for now. Bug: #46020, Change-Id: Iad212fd95773f39f3202480b3fa71f6a28c7698f dart-lang/language#1812 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211941 Commit-Queue: Samuel Rawlins <srawlins@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
dart-lang/language#1812 Closes #47147 Change-Id: Iaba365a583bca456c19a6edba8801bab630304c5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212590 Reviewed-by: Dmitry Stefantsov <dmitryas@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
Update section "Generic Function Instantiation" to allow this operation on an existing function object, in addition to the currently supported cases (where the expression denotes a declaration).
This update does not yet mention explicit instantiation, but I think the work needed to allow the current generalization and the work needed to support explicit instantiation are rather well separated. So it's not a waste of time to those two things in two steps (and we can then do 'constructor-tearoffs' as one single update, which is probably also nice).