aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Applications.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-03-10 17:15:20 +0100
committerMartin Odersky <odersky@gmail.com>2016-03-10 18:50:59 +0100
commit65639176ce59fd64cbecd90bf5680e64e471938f (patch)
tree2b7ebeebaa8b54bb228e6c571b8536fe4d5809bc /src/dotty/tools/dotc/typer/Applications.scala
parent9a624b9249024eec4e165b47e22fe3f029a9ae81 (diff)
downloaddotty-65639176ce59fd64cbecd90bf5680e64e471938f.tar.gz
dotty-65639176ce59fd64cbecd90bf5680e64e471938f.tar.bz2
dotty-65639176ce59fd64cbecd90bf5680e64e471938f.zip
Add second field to SeqLiteral
The field keeps track of the element type. This is necessary because JavaSeqLiteral is nonvariant and the elements might be empty, so we cannot always compute the type from the element types.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index 3b8c56ea6..3ad9902a4 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -442,7 +442,10 @@ trait Applications extends Compatibility { self: Typer =>
def makeVarArg(n: Int, elemFormal: Type): Unit = {
val args = typedArgBuf.takeRight(n).toList
typedArgBuf.trimEnd(n)
- val seqLit = if (methodType.isJava) JavaSeqLiteral(args) else SeqLiteral(args)
+ val elemtpt = TypeTree(elemFormal)
+ val seqLit =
+ if (methodType.isJava) JavaSeqLiteral(args, elemtpt)
+ else SeqLiteral(args, elemtpt)
typedArgBuf += seqToRepeated(seqLit)
}
@@ -771,7 +774,7 @@ trait Applications extends Compatibility { self: Typer =>
for (argType <- argTypes) assert(!argType.isInstanceOf[TypeBounds], unapplyApp.tpe.show)
val bunchedArgs = argTypes match {
case argType :: Nil =>
- if (argType.isRepeatedParam) untpd.SeqLiteral(args) :: Nil
+ if (argType.isRepeatedParam) untpd.SeqLiteral(args, untpd.TypeTree()) :: Nil
else if (args.lengthCompare(1) > 0 && ctx.canAutoTuple) untpd.Tuple(args) :: Nil
else args
case _ => args