Skip to content

Commit 6c7b7e3

Browse files
committed
Fix A* propagating outside matches
1 parent 8f08b71 commit 6c7b7e3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,15 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
420420
case _ => ifExpr
421421
}
422422
def ascription(tpt: Tree, isWildcard: Boolean) = {
423+
val underlyingTreeTpe =
424+
if (isRepeatedParamType(tpt)) TypeTree(defn.SeqType.appliedTo(pt :: Nil))
425+
else tpt
426+
423427
val expr1 =
424-
if (isWildcard) tree.expr.withType(tpt.tpe)
428+
if (isRepeatedParamType(tpt)) tree.expr.withType(defn.SeqType.appliedTo(pt :: Nil))
429+
else if (isWildcard) tree.expr.withType(tpt.tpe)
425430
else typed(tree.expr, tpt.tpe.widenSkolem)
426-
assignType(cpy.Typed(tree)(expr1, tpt), tpt)
431+
assignType(cpy.Typed(tree)(expr1, tpt), underlyingTreeTpe)
427432
}
428433
if (untpd.isWildcardStarArg(tree))
429434
cases(

0 commit comments

Comments
 (0)