Skip to content

Improve quoted pattern type inference #8766

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

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Apr 22, 2020

Types a splice applied to some arguments $f(arg1, ..., argn) in a quote pattern.

The tree is desugared into $f.apply(arg1, ..., argn) where the expression $f
is expected to type as a function type (T1, ..., Tn) => R.
Ti is the type of the argument argi and R if the type of the prototype.
The prototype must be fully defined to be able to infer the type of R.

This way we can rewrite the pattern ${f: Int => Int}(3) to $f(3) or $f(3): Int (if the result type is not known).

Types a splice applied to some arguments `$f(arg1, ..., argn)` in a quote pattern.

 The tree is desugared into `$f.apply(arg1, ..., argn)` where the expression `$f`
 is expected to type as a function type `(T1, ..., Tn) => R`.
 `Ti` is the type of the argument `argi` and R if the type of the prototype.
 The prototype must be fully defined to be able to infer the type of `R`.
@nicolasstucki nicolasstucki self-assigned this Apr 22, 2020
@nicolasstucki nicolasstucki marked this pull request as ready for review April 22, 2020 12:49
@nicolasstucki nicolasstucki requested a review from odersky April 22, 2020 12:49
@odersky odersky merged commit 7c4c672 into scala:master Apr 27, 2020
@odersky odersky deleted the improve-quoted-pattern-type-inference branch April 27, 2020 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants