diff options
author | Martin Odersky <odersky@gmail.com> | 2013-10-26 10:29:45 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-10-26 10:29:50 +0200 |
commit | 961c0569eb0a54cf95363bab79add43da310984c (patch) | |
tree | efe723b1b6a182ec0f99c5f3d33b78a5a90d8bdf /src/dotty/tools/dotc/typer/Applications.scala | |
parent | 8c1cc60c7ef9c13b312fceaf6cb8c8c129753344 (diff) | |
download | dotty-961c0569eb0a54cf95363bab79add43da310984c.tar.gz dotty-961c0569eb0a54cf95363bab79add43da310984c.tar.bz2 dotty-961c0569eb0a54cf95363bab79add43da310984c.zip |
Fixed handling of varargs
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index 0abaa17fe..e2e40e7e2 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -327,17 +327,10 @@ trait Applications extends Compatibility { self: Typer => init() } - /** Subtrait of Application for the cases where arguments are (typed or - * untyped) trees. - */ - trait TreeApplication[T >: Untyped] extends Application[Trees.Tree[T]] { - type TypeArg = Tree - def isVarArg(arg: Trees.Tree[T]): Boolean = isWildcardStarArg(arg) - } - /** Subclass of Application for applicability tests with trees as arguments. */ class ApplicableToTrees(methRef: TermRef, args: List[Tree], resultType: Type)(implicit ctx: Context) - extends TestApplication(methRef, methRef, args, resultType) with TreeApplication[Type] { + extends TestApplication(methRef, methRef, args, resultType) { + def isVarArg(arg: Tree): Boolean = tpd.isWildcardStarArg(arg) def argType(arg: Tree): Type = normalize(arg.tpe) def treeToArg(arg: Tree): Tree = arg } @@ -355,8 +348,9 @@ trait Applications extends Compatibility { self: Typer => */ abstract class TypedApply[T >: Untyped]( app: untpd.Apply, fun: Tree, methRef: TermRef, args: List[Trees.Tree[T]], resultType: Type)(implicit ctx: Context) - extends Application(methRef, fun.tpe, args, resultType) with TreeApplication[T] { + extends Application(methRef, fun.tpe, args, resultType) { type TypedArg = Tree + def isVarArg(arg: Trees.Tree[T]): Boolean = untpd.isWildcardStarArg(arg) private var typedArgBuf = new mutable.ListBuffer[Tree] private var liftedDefs: mutable.ListBuffer[Tree] = null private var myNormalizedFun: Tree = fun @@ -369,7 +363,7 @@ trait Applications extends Compatibility { self: Typer => val args = typedArgBuf.takeRight(n).toList typedArgBuf.trimEnd(n) val seqLit = if (methodType.isJava) JavaSeqLiteral(args) else SeqLiteral(args) - typedArgBuf += seqLit + typedArgBuf += seqToRepeated(seqLit) } def fail(msg: => String, arg: Trees.Tree[T]) = { |