-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Regression: tuple inline matching and head/tail #21277
Comments
That looks expected to me. The previous reduction relied on some unsound behavior of match types, which we fixed since. |
Seems we are treating it as intentional behaviour. Closing this. |
Thanks for the quick response. @sjrd, can you please elaborate about this error? Is there some recommended way of working with inline tuple matching that circumvents this error? Or the workaround I mentioned the only way to do it? For my real use case, I wouldn't mind using inline def foo[T <: Tuple](t: T) =
inline t match
case (xx: h) *: (yy: t)=>
val x: h = xx
val y: t = yy And that doesn't seem to work either as Thanks |
For anyone else stumbling on this, found a slightly more pleasant workaround for this issue: inline def bar[T <: Tuple](t: T) =
inline t match
case tt: (h *: t) =>
val head *: tail = tt
// `head` has type `h`
// `tail` `has type `t` But I still think that this behavior renders Thanks |
Compiler version
3.4.2
Minimized code
Output
Expectation
The code should compile.
This is a regression compared to 3.3.3 where the same code compiles as expected.
Also, the following workaround works for some reason:
Note the explicitly typed assignment to
ttt
.The text was updated successfully, but these errors were encountered: