Skip to content

Internal error when pattern matching #1260

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
scabug opened this issue Aug 21, 2008 · 5 comments
Closed

Internal error when pattern matching #1260

scabug opened this issue Aug 21, 2008 · 5 comments
Milestone

Comments

@scabug
Copy link

scabug commented Aug 21, 2008

case class Foo(a: String, b: String)

object Bar {
  def unapply(s: String): Option[Long] =
    try { Some(s.toLong) } catch { case _ => None }
}

object Test {
  def main(args: Array[String]) {
    val f = Foo("1", "2")
    f match {
      case Foo(Bar(1), Bar(2)) => ()

      // failes:
      case Foo(Bar(i), Bar(j)) if i >= 0 => () 

      // works:
      //case Foo(Bar(i: Long), Bar(j)) if i >= 0 => ()
      //case Foo(Bar(i), Bar(j)) => ()
    }
  }
}
error: internal error, types don't match: pattern variable value i:Long temp variable temp11:Int(1)
one error found
@scabug
Copy link
Author

scabug commented Aug 21, 2008

Imported From: https://issues.scala-lang.org/browse/SI-1260?orig=1
Reporter: Eskil (eskil)
Assignee: @DRMacIver

@scabug
Copy link
Author

scabug commented Aug 21, 2008

@michelou said:
I confirm the bug (2.7.2.RC1 on Win XP).

@scabug
Copy link
Author

scabug commented Oct 26, 2008

@DRMacIver said:
Should be fixed in r16341.

@scabug
Copy link
Author

scabug commented Nov 9, 2008

@DRMacIver said:
This fix turned out to be unsound, so I've reverted it in r16534.

@scabug
Copy link
Author

scabug commented Jul 11, 2009

@paulp said:
Fixed in r18248.

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

No branches or pull requests

1 participant