Skip to content

Commit 2d64743

Browse files
committed
SIP-23 Account for literal types in varargs translation
Before: sandbox/test.scala:2: error: type mismatch; found : Array[1] required: Array[Int]
1 parent 34cbcbb commit 2d64743

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/compiler/scala/tools/nsc/transform/UnCurry.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ abstract class UnCurry extends InfoTransform
322322
args.take(formals.length - 1) :+ (suffix setType formals.last)
323323
}
324324

325-
val args1 = if (isVarArgTypes(formals)) transformVarargs(formals.last.typeArgs.head) else args
325+
val args1 = if (isVarArgTypes(formals)) transformVarargs(formals.last.typeArgs.head.widen) else args
326326

327327
map2(formals, args1) { (formal, arg) =>
328328
if (!isByNameParamType(formal))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-Xexperimental
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
object Test extends App {
2+
val x = List.apply[1](1)
3+
assert(x == List(1))
4+
}

0 commit comments

Comments
 (0)