Closed
Description
$ cat abc.scala
trait Break { protected val break: Int; }
case class BreakImpl(protected val break: Int) extends Break {}
object Test {
def f2(x: Break) = x match {
case BreakImpl(x) => BreakImpl
case _ => -1
}
def f4(x: Any) = x match {
case BreakImpl(x) => x
case _ => -1
}
def main(args: Array[String]): Unit = {
val break = BreakImpl(22)
assert(f2(break) == 22)
assert(f4(break) == 22)
}
}
$ dotc abc.scala
exception while typing [cannot display due to scala.MatchError: List() (of class scala.collection.immutable.Nil$), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@445b84c0] of class class dotty.tools.dotc.ast.Trees$Apply # 734
exception while typing [cannot display due to scala.MatchError: List() (of class scala.collection.immutable.Nil$), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@61a52fbd] of class class dotty.tools.dotc.ast.Trees$Apply # 736
exception while typing [cannot display due to scala.MatchError: List() (of class scala.collection.immutable.Nil$), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@233c0b17] of class class dotty.tools.dotc.ast.Trees$Block # 743
exception while typing [cannot display due to scala.MatchError: List() (of class scala.collection.immutable.Nil$), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@63d4e2ba] of class class dotty.tools.dotc.ast.Trees$DefDef # 744
exception while typing [cannot display due to scala.MatchError: List() (of class scala.collection.immutable.Nil$), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@7bb11784] of class class dotty.tools.dotc.ast.Trees$TypeDef # 746
exception while typing [cannot display due to scala.MatchError: List() (of class scala.collection.immutable.Nil$), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@5594a1b5] of class class dotty.tools.dotc.ast.Trees$PackageDef # 822
exception occurred while compiling abc.scala
Exception in thread "main" scala.MatchError: List() (of class scala.collection.immutable.Nil$)
at dotty.tools.dotc.core.TypeOps$class.dominators$1(TypeOps.scala:196)
at dotty.tools.dotc.core.TypeOps$class.approximateOr$1(TypeOps.scala:242)
at dotty.tools.dotc.core.TypeOps$class.orDominator(TypeOps.scala:256)
at dotty.tools.dotc.core.Contexts$Context.orDominator(Contexts.scala:57)
at dotty.tools.dotc.core.Types$OrType.join(Types.scala:2233)
at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:453)
at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:580)
<snipped>