diff --git a/compiler/src/dotty/tools/dotc/core/TypeApplications.scala b/compiler/src/dotty/tools/dotc/core/TypeApplications.scala index 000125c25d62..ce386e17ec68 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeApplications.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeApplications.scala @@ -455,7 +455,10 @@ class TypeApplications(val self: Type) extends AnyVal { self.derivedExprType(tp.translateParameterized(from, to)) case _ => if (self.derivesFrom(from)) { - val arg = self.baseType(from).argInfos.head + def elemType(tp: Type): Type = tp match + case tp: AndOrType => tp.derivedAndOrType(elemType(tp.tp1), elemType(tp.tp2)) + case _ => tp.baseType(from).argInfos.head + val arg = elemType(self) val arg1 = if (wildcardArg) TypeBounds.upper(arg) else arg to.typeRef.appliedTo(arg1) } diff --git a/tests/pos/i8056.scala b/tests/pos/i8056.scala new file mode 100644 index 000000000000..f105b021c764 --- /dev/null +++ b/tests/pos/i8056.scala @@ -0,0 +1,5 @@ +object O{ + def m(x: Any*) = () + def n(l: List[Int] | List[String]): Unit = m(l: _*) + def n2(l: List[Int] & List[String]): Unit = m(l: _*) +} \ No newline at end of file