scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

Invalid type error in nested pattern match with existentials #9570

Open scabug opened 8 years ago

scabug commented 8 years ago
class Base[T] {
  def set(t: T): Unit = ()
}
class Inter[T] extends Base[T]
class Concrete extends Inter[List[String]]

object Fail {
  val r: Base[_] = new Concrete
  r match {
    case i: Inter[_] =>
      i match {
        case c: Concrete =>
          c.set(Nil)
      }
  }
}

Result:

Error:(16, 17) type mismatch;
 found   : scala.collection.immutable.Nil.type
 required: _1
          c.set(Nil)
                ^
scabug commented 8 years ago

Imported From: https://issues.scala-lang.org/browse/SI-9570?orig=1 Reporter: @ghik Affected Versions: 2.11.7