diff options
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 23e7cdb7b..4f27912f1 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -420,14 +420,19 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit case _ => ifExpr } def ascription(tpt: Tree, isWildcard: Boolean) = { + val underlyingTreeTpe = + if (isRepeatedParamType(tpt)) TypeTree(defn.SeqType.appliedTo(pt :: Nil)) + else tpt + val expr1 = - if (isWildcard) tree.expr.withType(tpt.tpe) + if (isRepeatedParamType(tpt)) tree.expr.withType(defn.SeqType.appliedTo(pt :: Nil)) + else if (isWildcard) tree.expr.withType(tpt.tpe) else typed(tree.expr, tpt.tpe.widenSkolem) - assignType(cpy.Typed(tree)(expr1, tpt), tpt) + assignType(cpy.Typed(tree)(expr1, tpt), underlyingTreeTpe) } if (untpd.isWildcardStarArg(tree)) cases( - ifPat = ascription(TypeTree(defn.SeqType.appliedTo(pt :: Nil)), isWildcard = true), + ifPat = ascription(TypeTree(defn.RepeatedParamType.appliedTo(pt)), isWildcard = true), ifExpr = seqToRepeated(typedExpr(tree.expr, defn.SeqType)), wildName = nme.WILDCARD_STAR) else { @@ -975,7 +980,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit typed(untpd.Bind(tree.name, arg).withPos(tree.pos), arg.tpe) :: Nil) case _ => val flags = if (tree.isType) BindDefinedType else EmptyFlags - val sym = ctx.newSymbol(ctx.owner, tree.name, flags, body1.tpe, coord = tree.pos) + val sym = ctx.newSymbol(ctx.owner, tree.name, flags | Case, body1.tpe, coord = tree.pos) assignType(cpy.Bind(tree)(tree.name, body1), sym) } } |