File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -414,7 +414,7 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase =>
414414 *
415415 * This then translates to
416416 *
417- * scala.runtime.ArraySeqBuilcder .ofInt(2 + xs.length + ys.length)
417+ * scala.runtime.VarArgsBuilder .ofInt(2 + xs.length + ys.length)
418418 * .add(1)
419419 * .addSeq(xs)
420420 * .add(2)
@@ -450,10 +450,11 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase =>
450450 elems.foldLeft(builder.appliedTo(totalLength)): (bldr, elem) =>
451451 elem match
452452 case spread(arg) =>
453- val selector =
454- if arg.tpe.derivesFrom(defn.SeqClass ) then " addSeq"
455- else " addArray"
456- bldr.select(selector.toTermName).appliedTo(arg)
453+ if arg.tpe.derivesFrom(defn.SeqClass ) then
454+ bldr.select(" addSeq" .toTermName).appliedTo(arg)
455+ else
456+ bldr.select(" addArray" .toTermName).appliedTo(
457+ arg.ensureConforms(defn.ArrayOf (elemType)))
457458 case _ => bldr.select(" add" .toTermName).appliedTo(elem)
458459 .select(" result" .toTermName)
459460 .appliedToNone
Original file line number Diff line number Diff line change 1+ ooffoobar
Original file line number Diff line number Diff line change 1+ import language .experimental .multiSpreads
2+
3+ def foo (x : CharSequence * ): String = x.mkString
4+ val strings : Array [String ] = Array (" foo" , " bar" )
5+
6+ @ main def Test =
7+ println(foo((" oof" : CharSequence ), strings* ))
You can’t perform that action at this time.
0 commit comments