-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Match type with bounds fails to reduce #14477
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
It says:
I thought it might be the type alias indirection, but, no, it looks even worst when you inline MyFoo:
|
Just to actually write it down without the extra type alias, and without a singleton type involved either: trait Foo[A, X <: A]
type FooX[F] = F match { case Foo[_, x] => x }
"": FooX[Foo[String, String]] |
Dale is thinking about at least three possible solution paths. In decreasing order of generality:
With the third seeming most promising at the moment. I don't have any gut feeling about the viability of the first two options, but the third seems very plausible to me. The existing code: def tparamBounds = tparam.paramInfoAsSeenFrom(tpt1.tpe.appliedTo(tparams.map(_ => TypeBounds.empty))) seems plausibly unfinished/naïve, as if cases such as this ticket simply weren't considered |
Realising that I want to replace uses of type parameters in the bounds (with type references of the fresh pattern symbols) is similar in nature to general substituters lead me to NamedType's |
This is what the subtype trace looks like:
First checking the subtyping of arg
Second checking the subtyping of arg
then
And therefore it fails:
It actually does a few more checks (haven't where these checks are from):
and then fails:
@odersky and/or @smarter does it look to you like There's almost already something there in |
Hey @odersky, perhaps you can help me out, I've been pouring days into trying to understand how typing works on this code. Given |
It's not my field. I think @OlivierBlanvillain is better placed to answer. |
Is
related? It gives the error:
Even in 3.1.2-RC1.
Originally posted by @s5bug in #6697 (comment)
The text was updated successfully, but these errors were encountered: