Skip to content

covariant type parameter in sealed trait causes match may not be exhaustive #6197

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
fkowal opened this issue Mar 30, 2019 · 0 comments · Fixed by #6889
Closed

covariant type parameter in sealed trait causes match may not be exhaustive #6197

fkowal opened this issue Mar 30, 2019 · 0 comments · Fixed by #6889

Comments

@fkowal
Copy link

fkowal commented Mar 30, 2019

object Test {
  sealed trait Cause[+E]

  object Cause {
    final case class Fail[E](value: E) extends Cause[E]
  }

  def fn(cause: Cause[Any]): String =
    cause match {
      case Cause.Fail(t: Throwable) => t.toString
      case Cause.Fail(any)          => any.toString
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants