Skip to content

Why doesn't sourcecode.Args capture argument values under Scala 3? #111

Closed
@AdamPaynter

Description

@AdamPaynter

Given this method:

  def printArgs(a: Int, b: Long, c: String): Unit = {
    val args = implicitly[sourcecode.Args]
    println(args)
  }

When I call printArgs(1, 2, "3"), the following lines are printed to the console:

Scala 2.13.5

Args(List(List(Text(1,a), Text(2,b), Text(3,c))))

Scala 3.0.0-RC3

Args(List(List(Text(None,a), Text(None,b), Text(None,c))))

I vaguely remember reading somewhere that this is a shortcoming of Scala 3's metaprogramming. Is this correct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions