Skip to content

GADT bounds are not precise enough #4075

Closed
@Blaisorblade

Description

@Blaisorblade

#1754 is fixed but the error in #3990 seems incorrect:

case class One[T](fst: T)

object Test {
  def bad[T](e: One[T]) = e match {
    case foo: One[a] =>
      val t: T = e.fst
      val nok: Nothing = t // should not compile
      val ok: a = t // does compile
  }
}

The nok line should not compile because T = a, as shown by the ok line, but the error claims that T >: a, which is true but incomplete and misleading:

7   |      val nok: Nothing = t // should not compile
    |                         ^
    |                  found:    T(t)
    |                  required: Nothing
    |
    |                  where:    T is a type in method bad with bounds >: a

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions