Skip to content
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

existential type bound check fails in value class #11562

kailuowang opened this issue Jun 7, 2019 · 1 comment


None yet
2 participants
Copy link

commented Jun 7, 2019

Happens in 2.12 and 2.13 (didn't check in 2.11)

object Test {
  trait M[A] {
    def d[AA <: A](a: AA): Unit
  class MWorks[A](val a: A) {
    def d(M: M[_ >: A]): Unit = M.d(a)

  class MFails[A](val a: A) extends AnyVal {
    def d(M: M[_ >: A]): Unit = M.d(a)  //fails compilation in value class

The same simple code in a value class causes compilation error:

type arguments [A] do not conform to method d's type parameter bounds [AA <: _$2]


To be clear, the bound AA <: A in trait M is clear redundant, but it's needed in the real use case where the parameter is of slightly more complex type.


This comment has been minimized.

Copy link

commented Jun 7, 2019

Sounds similar to #11383 (comment), but with the type parameter on the class rather than the method. I suspect the root cause is the same.

@hrhino hrhino added this to the Backlog milestone Jun 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.