Skip to content
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

Support type variable with bounds in quoted pattern #16910

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Feb 14, 2023

Support explicit type variable definition in quoted patterns. This allows users to set explicit bounds or use the binding twice.

case '[type x; `x`] =>
case '[type x; Map[`x`, `x`]] =>
case '[type x <: List[Any]; `x`] =>
case '[type f[X]; `f`] =>
case '[type f <: AnyKind; `f`] =>

Previously this was only possible on quoted expression patterns case '{ ... }. We also had no way to set bounds for type variables in quoted type patterns.

Fixes #10864
Fixes #11738

SIP: scala/improvement-proposals#59

@nicolasstucki nicolasstucki self-assigned this Feb 14, 2023
@nicolasstucki nicolasstucki force-pushed the support-type-block-syntax-in-quoted-pattern branch 3 times, most recently from 0fae78d to f2ceaa1 Compare February 15, 2023 16:58
@nicolasstucki nicolasstucki changed the title Support type block syntax in quoted pattern Support type variable with bounds in quoted pattern Feb 16, 2023
@nicolasstucki nicolasstucki added the needs-minor-release This PR cannot be merged until the next minor release label Feb 16, 2023
@nicolasstucki nicolasstucki force-pushed the support-type-block-syntax-in-quoted-pattern branch from f2ceaa1 to 1c41faa Compare February 16, 2023 14:43
@prolativ

This comment was marked as outdated.

@Kordyjan Kordyjan added this to the 3.4.0 milestone Feb 20, 2023
@nicolasstucki nicolasstucki force-pushed the support-type-block-syntax-in-quoted-pattern branch from 1c41faa to ae801c0 Compare February 21, 2023 08:09
@nicolasstucki nicolasstucki force-pushed the support-type-block-syntax-in-quoted-pattern branch from ae801c0 to bcb2c04 Compare April 28, 2023 06:46
Support explicit type variable definition in quoted patterns.
This allows users to set explicit bounds or use the binding twice.
Previously this was only possible on quoted expression patterns case '{ ... }.

```scala
case '[type x; `x`] =>
case '[type x; Map[`x`, `x`]] =>
case '[type x <: List[Any]; `x`] =>
case '[type f[X]; `f`] =>
case '[type f <: AnyKind; `f`] =>
```

Fixes scala#10864
Fixes scala#11738
@nicolasstucki nicolasstucki force-pushed the support-type-block-syntax-in-quoted-pattern branch from bcb2c04 to 40c2922 Compare April 28, 2023 06:47
@nicolasstucki
Copy link
Contributor Author

Moved into #17362

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-minor-release This PR cannot be merged until the next minor release
Projects
None yet
3 participants