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 matching on GATD generating .asInstanceOf[Nothing] #1515

Closed
OlivierBlanvillain opened this issue Sep 15, 2016 · 3 comments
Closed

Pattern matching on GATD generating .asInstanceOf[Nothing] #1515

OlivierBlanvillain opened this issue Sep 15, 2016 · 3 comments
Assignees

Comments

@OlivierBlanvillain
Copy link
Contributor

The following example:

sealed trait Trait[T]

final case class Case[T](e: T) extends Trait[T]

object Demo {
  def main(args: Array[String]): Unit = {

    def f[H](t: Trait[H]): Unit =
      t match {
        case Case(e) => println(Some(e))
      }

    f(Case(1))

  }
}

Fails at run time with java.lang.ClassCastException: java.lang.Integer cannot be cast to scala.runtime.Nothing$.

@smarter
Copy link
Member

smarter commented Sep 15, 2016

I have some work-in-progress GADT fixes that I think are related to this, I'll take a look in the next few days

@smarter smarter self-assigned this Sep 15, 2016
@OlivierBlanvillain
Copy link
Contributor Author

OlivierBlanvillain commented Oct 10, 2016

Bump (I think this issue is affecting large portions of ScalaTest source code)

@smarter
Copy link
Member

smarter commented Oct 10, 2016

Alright, let me get this on top of my todo list

odersky added a commit to dotty-staging/dotty that referenced this issue Oct 14, 2016
smarter added a commit that referenced this issue Oct 14, 2016
Fix #1515: Don't narrow gadt bounds when frozen
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

3 participants