Skip to content

Support Symbol name in @deprecatedName - #27048

Open
SolalPirelli wants to merge 4 commits into
scala:mainfrom
dotty-staging:solal/deprecatedName-symbol
Open

SolalPirelli wants to merge 4 commits into
scala:mainfrom
dotty-staging:solal/deprecatedName-symbol

Conversation

@SolalPirelli

Copy link
Copy Markdown
Contributor

Fixes #27042
Fixes #27038

Have you relied on LLM-based tools in this contribution?

No

How was the solution tested?

New automated tests (including the issue's reproducer, if applicable)

@som-snytt som-snytt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The accepted idiom is a bit narrow. Other computed Symbol args are still silently ignored.

Comment thread tests/pos/deprecatedName-symbol.scala
@SolalPirelli

Copy link
Copy Markdown
Contributor Author

@som-snytt you're right, I added handling for this and tests

@SolalPirelli
SolalPirelli force-pushed the solal/deprecatedName-symbol branch from 629f5c6 to e703048 Compare September 11, 2026 14:04
val rep = new StringBuilder
if failed == 0 && failedTests.isEmpty then
rep.append(s"${Console.BOLD}${Console.GREEN}== Vulpix Test Report: $passed suites passed, no failures (${skippedTests.size} skipped) ==${Console.RESET}")
rep.append(s"${Console.BOLD}${Console.GREEN}== Vulpix Test Report: all $passed suites passed (${skippedTests.size} skipped) ==${Console.RESET}")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matt wanted to not see this when grepping for "failure"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, this will change my life, thank you! 🥳

def i(
@deprecatedName(Symbol("x" + 1)) a: Int // error
): Int = a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scala 2 supports

def j(@deprecatedName(since = "forever", name = Symbol("x")) a: Int): Int = a

but doesn't issue deprecation when args are swapped.

This commit does not support

@deprecatedName(name = Symbol("x"))

That is probably tolerable. When can the deprecated constructor be removed? Soon enough.

@som-snytt som-snytt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still lgtm as it is nits picked all the way down.

Edit: I forgot I was going to say, "What's not to like?" which one may take rhetorically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@deprecatedName annotation does not work if Symbol false positive deprecated parameter name must be distinct from other names if Symbol

4 participants