aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-10-26 10:29:45 +0200
committerMartin Odersky <odersky@gmail.com>2013-10-26 10:29:50 +0200
commit961c0569eb0a54cf95363bab79add43da310984c (patch)
treeefe723b1b6a182ec0f99c5f3d33b78a5a90d8bdf /src/dotty/tools/dotc/typer/Typer.scala
parent8c1cc60c7ef9c13b312fceaf6cb8c8c129753344 (diff)
downloaddotty-961c0569eb0a54cf95363bab79add43da310984c.tar.gz
dotty-961c0569eb0a54cf95363bab79add43da310984c.tar.bz2
dotty-961c0569eb0a54cf95363bab79add43da310984c.zip
Fixed handling of varargs
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index a22d128e3..1bdc5516c 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -407,9 +407,13 @@ class Typer extends Namer with Applications with Implicits {
import untpd._
typed(Bind(id.name, Typed(Ident(nme.WILDCARD), tree.tpt)).withPos(id.pos))
case _ =>
- val tpt1 = typedType(tree.tpt)
- val expr1 = typedExpr(tree.expr, tpt1.tpe)
- cpy.Typed(tree, expr1, tpt1).withType(tpt1.tpe)
+ if (untpd.isWildcardStarArg(tree))
+ seqToRepeated(typedExpr(tree.expr, defn.SeqType))
+ else {
+ val tpt1 = typedType(tree.tpt)
+ val expr1 = typedExpr(tree.expr, tpt1.tpe)
+ cpy.Typed(tree, expr1, tpt1).withType(tpt1.tpe)
+ }
}
}
@@ -608,7 +612,7 @@ class Typer extends Namer with Applications with Implicits {
def typedSeqLiteral(tree: untpd.SeqLiteral, pt: Type)(implicit ctx: Context): SeqLiteral = track("typedSeqLiteral") {
val proto1 = pt.elemType orElse WildcardType
val elems1 = tree.elems mapconserve (typed(_, proto1))
- cpy.SeqLiteral(tree, elems1) withType ctx.typeComparer.lub(elems1.tpes)
+ cpy.SeqLiteral(tree, elems1) withType defn.SeqType.appliedTo(ctx.typeComparer.lub(elems1.tpes))
}
def typedTypeTree(tree: untpd.TypeTree, pt: Type)(implicit ctx: Context): TypeTree = track("typedTypeTree") {