Skip to content

Fix #3669: Treat java repeated arguments like scalac's #3674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
val args = typedArgBuf.takeRight(n).toList
typedArgBuf.trimEnd(n)
val elemtpt = TypeTree(elemFormal)
val seqLit =
if (methodType.isJavaMethod) JavaSeqLiteral(args, elemtpt)
else SeqLiteral(args, elemtpt)
typedArgBuf += seqToRepeated(seqLit)
typedArgBuf += seqToRepeated(SeqLiteral(args, elemtpt))
}

def harmonizeArgs(args: List[TypedArg]) = harmonize(args)
Expand Down
3 changes: 2 additions & 1 deletion compiler/test/dotty/tools/vulpix/TestConfiguration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ object TestConfiguration {
} mkString(":")
}

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

val basicDefaultOptions = checkOptions ++ noCheckOptions ++ yCheckOptions
val defaultUnoptimised = TestFlags(classPath, runClassPath, basicDefaultOptions)
Expand Down
10 changes: 10 additions & 0 deletions tests/pos/i3669.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import java.nio.file._

class Test {
def test(xs: Array[String]) = {
val p1 = Paths.get("Hello")
val p2 = Paths.get("Hello", "World")
val p3 = Paths.get("Hello", "World", "!")
val p4 = Paths.get("Hello", xs: _*)
}
}