Skip to content

Behavior of overloaded varargs and default parameter value differs from Scala 2 #14765

Closed
@FlorianCassayre

Description

@FlorianCassayre

Compiler version

3.1.2-RC1 down to 3.0.0

Minimized code

def f(x: Int = 0): Int = 1
def f(x: Int*): Int = 2

println(f())

Output

Prints:

  • 1 in Scala 3
  • 2 in Scala 2

Expectation

Expected the behavior to remain the same as in Scala 2.

This may be intended, but it looks like a regression to me (that could potentially break things silently).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions