-
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
Tuple.Head being unable to work with NonEmptyTuple in match types. #17186
Comments
I think this should not compile, but the error message should be better. To resolve this match type, we need to widen X to The error message is misleading, however. It should say that the instantiation is not unique. |
This kind of behavior can be recreated in a lot of instances: type RemoveTwo[X <: Tuple3[Any, Any, Any]] = Tuple.Tail[Tuple.Tail[X]] // error
type AltMiddle[X <: Tuple3[Any, Any, Any]] = Tuple.Tail[Tuple.Init[X]] // error
type RemoveTwo[X <: Tuple3[Any, Any, Any]] = Tuple.Head[Tuple.Concat[X, Tuple]] // error Maybe we shouldn't have |
I'd personally treat this as not being related to match types at all. If anything, this is correct behavior since I think |
Fixes #17186. I think this is correct behaviour since we already allow things like ```Scala val a = List(1).tail val b = Tuple1(1).tail ```
Compiler version
3.3.1-RC1
Minimized code
Output
Expectation
Should compile.
The text was updated successfully, but these errors were encountered: