Skip to content

Unused temporary for lonely vararg in named args rewrite #11964

@som-snytt

Description

@som-snytt

reproduction steps

object t7 {
  def f(a: Int, b: String*) = "first"
}
object Test extends App {
  println(t7.f(1))
  println(t7.f(a = 19))
  println(t7.f(a = 28, b = "sl19"))
  println(t7.f(b = "sl19", a = 28))
}

problem

$ scalac -Xlint unused-fresh.scala
unused-fresh.scala:8: warning: local val x$1 in value <local Test> is never used
  println(t7.f(b = "sl19", a = 28))
                   ^
one warning found

where

      scala.Predef.println({
        <artifact> val x$1: Seq = scala.collection.immutable.Seq.apply(scala.runtime.ScalaRunTime.wrapRefArray(Array[String]{"sl19"}.$asInstanceOf[Array[Object]]())).$asInstanceOf[Seq]();
        <artifact> val x$2: Int(28) = 28;
        t7.f(28, scala.runtime.ScalaRunTime.wrapRefArray(Array[String]{"sl19"}.$asInstanceOf[Array[Object]]()))
      });

expectation

Less cruft.

Metadata

Metadata

Assignees

Labels

fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)has PRhelp wantedperformance

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions