Skip to content

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

Closed
@fkowal

Description

@fkowal
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
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions