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

2.8.0.Beta1-RC1: pattern match on existential type generates wrong type #2635

Closed
scabug opened this issue Nov 14, 2009 · 3 comments
Closed
Assignees

Comments

@scabug
Copy link

scabug commented Nov 14, 2009

The following code compiles and runs with 2.7.7 but fails to compile
with 2.8.0.Beta1-RC1:

abstract class Base

object Test
{
  def run(c: Class[_ <: Base]): Unit = {
  }

  def main(args: Array[String]): Unit =
  {
    val sc: Option[Class[_ <: Base]] = Some(classOf[Base])
    sc match {
      case Some(c) => run(c)
      case None =>
    }
  }
}
t.scala:12: error: type mismatch;
 found   : java.lang.Class[_0] where type _0
 required: Class[_ <: Base]
      case Some(c) => run(c)
@scabug
Copy link
Author

scabug commented Nov 14, 2009

Imported From: https://issues.scala-lang.org/browse/SI-2635?orig=1
Reporter: @blair

@scabug
Copy link
Author

scabug commented Nov 16, 2009

@adriaanm said:
I think this is a bug in the pattern matcher, because of which c's type is not propagated properly

changing the line to

      case Some((c: Class[_ <: Base])) => run(c)

results in:

/Users/adriaan/git/scala/test/pending/pos/t2635.scala:12: error: not found: type _$$3
      case Some((c: Class[_ <: Base])) => run(c)

this was probably an existing bug that was unmasked by the fix for #513

@scabug
Copy link
Author

scabug commented Nov 22, 2009

@odersky said:
(In r19769) Closed #2635

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

2 participants