Skip to content

dotc ignores deprecatedName #19077

@som-snytt

Description

@som-snytt

Compiler version

3.4.0-RC1-bin-SNAPSHOT-git-3b974c5

Minimized code

Welcome to Scala 3.4.0-RC1-bin-SNAPSHOT-git-3b974c5 (21, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> def f(@deprecatedName x: Int) = x*2
def f(x: Int): Int

scala> f(x=21)
val res0: Int = 42

scala> def f(@deprecatedName("y") x: Int) = x*2
def f(x: Int): Int

scala> f(y=21)
-- Error: --------------------------------------------------------------------------------------------------------------
1 |f(y=21)
  |  ^^^^
  |  method f: (x: Int): Int does not have a parameter y
1 error found

Expectation

Welcome to Scala 2.13.12 (OpenJDK 64-Bit Server VM, Java 21).
Type in expressions for evaluation. Or try :help.

scala> def f(@deprecatedName x: Int) = x*2
def f(x: Int): Int

scala> f(x=21)
          ^
       warning: naming parameter x is deprecated.
val res0: Int = 42

scala> def f(@deprecatedName("y") x: Int) = x*2
def f(x: Int): Int

scala> f(y=21)
          ^
       warning: the parameter name y is deprecated: use x instead
val res1: Int = 42

Perhaps Dotty hasn't been around long enough for anyone to change a parameter name.

This means it doesn't respect

scala> locally(x = 42)
                 ^
       warning: naming parameter x is deprecated.
val res0: Int = 42

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions