Closed
Description
minimized code
object O{
def m(x: Any*) = ()
def n(l: List[Int] | List[String]): Unit = m(l: _*)
}
Stack trace
exception occurred while typechecking varargs-union.scala
exception occurred while compiling varargs-union.scala
java.util.NoSuchElementException: head of empty list while compiling varargs-union.scala
Exception in thread "main" java.util.NoSuchElementException: head of empty list
at scala.collection.immutable.Nil$.head(List.scala:592)
at scala.collection.immutable.Nil$.head(List.scala:591)
at dotty.tools.dotc.core.TypeApplications$.translateParameterized$extension(TypeApplications.scala:458)
at dotty.tools.dotc.typer.TypeAssigner.toRepeated(TypeAssigner.scala:169)
at dotty.tools.dotc.typer.TypeAssigner.seqToRepeated(TypeAssigner.scala:171)
at dotty.tools.dotc.typer.Typer.seqToRepeated(Typer.scala:83)
at dotty.tools.dotc.typer.Typer.typedWildcardStarArgExpr$1(Typer.scala:689)
at dotty.tools.dotc.typer.Typer.typedTyped$$anonfun$2(Typer.scala:694)
at dotty.tools.dotc.typer.Typer.cases$1(Typer.scala:659)
at dotty.tools.dotc.typer.Typer.typedTyped(Typer.scala:695)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2156)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2209)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$2(ProtoTypes.scala:340)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:296)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:341)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:793)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:793)
at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:529)
at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:584)
at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:354)
at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:690)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:792)
at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:866)
at dotty.tools.dotc.typer.Applications.realApply$7$$anonfun$6(Applications.scala:927)
at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2375)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:938)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:973)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:83)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2151)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2209)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2247)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2367)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1679)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2138)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2208)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2247)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2281)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2325)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1812)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2141)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2208)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2247)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2281)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2325)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1938)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2182)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2209)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2247)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2367)
at dotty.tools.dotc.typer.FrontEnd.liftedTree1$2(FrontEnd.scala:78)
at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:83)
at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:42)
at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:84)
at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:114)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:305)
at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:167)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
at dotty.tools.dotc.Run.runPhases$5(Run.scala:177)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:185)
at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:65)
at dotty.tools.dotc.Run.compileUnits(Run.scala:192)
at dotty.tools.dotc.Run.compileSources(Run.scala:129)
at dotty.tools.dotc.Run.compile(Run.scala:112)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:36)
at dotty.tools.dotc.Driver.process(Driver.scala:189)
at dotty.tools.dotc.Driver.process(Driver.scala:158)
at dotty.tools.dotc.Driver.process(Driver.scala:170)
at dotty.tools.dotc.Driver.main(Driver.scala:197)
at dotty.tools.dotc.Main.main(Main.scala)