scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

dotc ignores deprecatedName

Open som-snytt opened this issue 2 years ago • 2 comments

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

som-snytt avatar Nov 25 '23 06:11 som-snytt

I had not noticed the related https://github.com/lampepfl/dotty/issues/19002

otherwise I would have been mentally prepared to find this unimplemented.

som-snytt avatar Nov 26 '23 15:11 som-snytt

Seems plausibly spree-sized

SethTisue avatar Feb 12 '25 02:02 SethTisue