Skip to content

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

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

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

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

soronpo opened this issue Oct 5, 2019 · 6 comments
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)
Milestone

Comments

@soronpo
Copy link

soronpo 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
Copy link
Member

joroKr21 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
Copy link
Member

joroKr21 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.

@joroKr21
Copy link
Member

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.

This is just #8039

@SethTisue SethTisue added this to the Backlog milestone Apr 27, 2023
@SethTisue SethTisue added the fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) label Apr 27, 2023
@SethTisue
Copy link
Member

@joroKr21 so we should close this as a duplicate, then?

@joroKr21
Copy link
Member

I don't know - this is a regression after all. But I think a principled solution would also have to fix #8039

@som-snytt
Copy link

Ignoring a type constructor requires rocket science

The rocket scientists say it's perfectly natural to just blow up and crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)
Projects
None yet
Development

No branches or pull requests

4 participants