Skip to content

Pattern matching with type annotations allows impossible cases #3144

Closed
@Jacoby6000

Description

@Jacoby6000

This should not compile:

  sealed trait Foo[T]
  case class Bar[T](s: String)
  
  def shouldError[T](foo: Foo[T]): String = 
    foo match {
      case bar: Bar[T] => bar.s
    }

Not even a warning is produced, as is.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions