-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Can't patmat to extract type constructor from quoted type #11738
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
Comments
Hey @nicolasstucki , would you happen to know an alternative way of doing this? I'm a bit stuck looking for a workaround :( |
Found workaround thanks to @smarter : use |
The root of the issue is that we have no way to infer or tell the kind of the type variable. The alternative is to use a pattern on expressions. I tried it but hit some bug or limitation. I need to dig into it. Nevertheless, the idea is to do '{ ??? : A } match
case '{ type f[X] ; ??? : `f`[t] } => |
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
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`] => ``` In combination with scala#16907 it would also allow ``` case '[type f[X]; `f`] => case '[type f <: AnyKind; `f`] => ``` and therefore solve scala#10864 and scala#11738
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`] => ``` In combination with scala#16907 it would also allow ```scala case '[type f[X]; `f`] => case '[type f <: AnyKind; `f`] => ``` and therefore solve scala#10864 and scala#11738
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`] => ``` In combination with scala#16907 it would also allow ```scala case '[type f[X]; `f`] => case '[type f <: AnyKind; `f`] => ``` and therefore solve scala#10864 and scala#11738
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Using 3.0.0-RC1, I'm trying to test whether a type is in the shape of
F[A]
.The tuple case works, no problem. The
f[a]
case doesn't compile and instead fails with:The text was updated successfully, but these errors were encountered: