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

pattern with inferred type params plus recursive call: crash #3880

scabug opened this issue Sep 29, 2010 · 3 comments


Copy link

commented Sep 29, 2010

[Deleted original report]

I have run into this again and it's going to be a problem for improving the pattern matcher's type parameter handling. I don't think it actually has anything to do with tailcalls (although it may), I think that's only where it's being revealed, and it originates in the typer. So I'm reassigning to scala_reviewer to see if it can get another look.

Here is a distillation of the problem.

abstract class Bar[+B] {
abstract class C1[+B] extends Bar[B] {  
  private[this] def g(x: C1[B]): Unit = ()

  // this method is fine: notice that it allows the call to g,
  // which requires C1[B], even though we matched on C1[_].
  // (That is good news.)
  private[this] def f1(x: Bar[B]): Unit = x match {
    case x: C1[_] => g(x)
  // this one crashes.
  private[this] def f2(x: Bar[B]): Unit = x match {
    case x: C1[_] => f2(x)

The crash:

Exception in thread "main"$$TypeError: type mismatch;
 found   : C1[_]
 required: Bar[B]

This comment has been minimized.

Copy link

commented Sep 29, 2010

Imported From:
Reporter: @paulp
Other Milestones: 2.10.0


This comment has been minimized.

Copy link

commented Oct 5, 2010

@adriaanm said:
scala solutions will save the day


This comment has been minimized.

Copy link

commented May 20, 2012

@retronym said:
Works now, test case:


@scabug scabug closed this May 21, 2012

@scabug scabug added the patmat label Apr 7, 2017

@scabug scabug added this to the 2.10.0-M3 milestone Apr 7, 2017

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