Skip to content

Match Types arguments with bounds do not conform the bounds #6697

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

Closed
zraffer opened this issue Jun 17, 2019 · 1 comment
Closed

Match Types arguments with bounds do not conform the bounds #6697

zraffer opened this issue Jun 17, 2019 · 1 comment

Comments

@zraffer
Copy link

zraffer commented Jun 17, 2019

minimized code

sealed trait Off
case class Of[sup, sub <: sup] extends Off
type Sup[O <: Off] = O match { case Of[sup, sub] => sup } // error here!
type Sub[O <: Off] = O match { case Of[sup, sub] => sub } // error here!
type Copy[O <: Off] = Of[Sup[O], Sub[O]]

emits type errors about variables sup, sub do not conform the bounds

expectation

no errors

OlivierBlanvillain added a commit to dotty-staging/dotty that referenced this issue Sep 13, 2019
Similarly to what's done for values when we write `case _: F[x]`, there
is no need to check that `x` conforms to its bounds as we are currently
binding it.
@OlivierBlanvillain OlivierBlanvillain removed their assignment Sep 25, 2019
OlivierBlanvillain added a commit that referenced this issue Oct 3, 2019
Fix #6697: Ingore bounds checks in match type patterns
@s5bug
Copy link

s5bug commented Feb 13, 2022

Is

sealed trait Foo[A, X <: A]

type FooX[F] = F match {
  case Foo[a, x] => x
}

type MyFoo = Foo[String, "hello"]

val hello: FooX[MyFoo] = "hello"

related? It gives the error:

Found:    ("hello" : String)
Required: FooX[MyFoo]

Even in 3.1.2-RC1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants