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

Regression: 2.13.x higher kinded match requires type parameter bounds #11760

Open
soronpo opened this issue Oct 5, 2019 · 2 comments

Comments

@soronpo
Copy link

commented Oct 5, 2019

When trying to match on a internal class of a higher kinded class, an error is generated for missing type arguments (works fine in 2.12.x and in dotty).
type arguments [_] do not conform to class Foo's type parameter bounds [B[I <: Int] <: Test.Bar[I]]

object Test {
  class Bar[I <: Int]
  class Foo[B[I <: Int] <: Bar[I]] {
    trait SomeThing
  }

  val x = new Bar[Int]

  x match {
    case y : Foo[_]#SomeThing => //error here
    case _ => 
  }  
}

I'll try to bisect this in the coming days and report back.

@soronpo soronpo changed the title Regression: 2.13.x higher kinded match requires type parameter bound Regression: 2.13.x higher kinded match requires type parameter bounds Oct 5, 2019
@joroKr21

This comment has been minimized.

Copy link

commented Oct 5, 2019

We talked about this on Gitter, the relevant PR is scala/scala#7260
Nothing changed behaviorally, but phases were reordered and now refchecks happens before patmat. Foo[_]#SomeThing is translated to a TypeTreeWithDeferredRefCheck to check the bounds during refchecks. But since patmat used to run before refchecks I guess those bounds were never checked before.

@joroKr21

This comment has been minimized.

Copy link

commented Oct 5, 2019

We might say that the bug is why the bounds don't match, but this bug has probably been always there, it just surfaced now because of the phase reordering.

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