Skip to content

Commit f4a22a8

Browse files
authored
Merge pull request #3674 from dotty-staging/ycheck
Fix #3669: Treat java repeated arguments like scalac's
2 parents c5e595e + 42bd8ff commit f4a22a8

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,10 +549,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
549549
val args = typedArgBuf.takeRight(n).toList
550550
typedArgBuf.trimEnd(n)
551551
val elemtpt = TypeTree(elemFormal)
552-
val seqLit =
553-
if (methodType.isJavaMethod) JavaSeqLiteral(args, elemtpt)
554-
else SeqLiteral(args, elemtpt)
555-
typedArgBuf += seqToRepeated(seqLit)
552+
typedArgBuf += seqToRepeated(SeqLiteral(args, elemtpt))
556553
}
557554

558555
def harmonizeArgs(args: List[TypedArg]) = harmonize(args)

compiler/test/dotty/tools/vulpix/TestConfiguration.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ object TestConfiguration {
4444
} mkString(":")
4545
}
4646

47-
val yCheckOptions = Array("-Ycheck:tailrec,resolveSuper,erasure,mixin,getClass,elimStaticThis,labelDef")
47+
// Ideally should be Ycheck:all
48+
val yCheckOptions = Array("-Ycheck:elimJavaPackages,refchecks,splitter,arrayConstructors,erasure,capturedVars,getClass,elimStaticThis,labelDef")
4849

4950
val basicDefaultOptions = checkOptions ++ noCheckOptions ++ yCheckOptions
5051
val defaultUnoptimised = TestFlags(classPath, runClassPath, basicDefaultOptions)

tests/pos/i3669.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import java.nio.file._
2+
3+
class Test {
4+
def test(xs: Array[String]) = {
5+
val p1 = Paths.get("Hello")
6+
val p2 = Paths.get("Hello", "World")
7+
val p3 = Paths.get("Hello", "World", "!")
8+
val p4 = Paths.get("Hello", xs: _*)
9+
}
10+
}

0 commit comments

Comments
 (0)