Skip to content

Fix #23241 - duplicate deprecation message for enum member accessed by name#23283

Merged
thewilsonator merged 1 commit into
dlang:masterfrom
PetarKirov:fix-23241-duplicate-deprecation
Jun 18, 2026
Merged

Fix #23241 - duplicate deprecation message for enum member accessed by name#23283
thewilsonator merged 1 commit into
dlang:masterfrom
PetarKirov:fix-23241-duplicate-deprecation

Conversation

@PetarKirov

Copy link
Copy Markdown
Member

Fixes #23241.

A deprecated enum member accessed by its unqualified name — an anonymous enum
member, a member found via with, or an ImportC enumerator — reported the
deprecation twice: once during name resolution and again in getVarExp(),
which already performs the deprecated/disabled checks itself.

This skips the redundant checkDeprecated/checkDisabled for enum members in the
two name-resolution paths, so the diagnostic is emitted exactly once.

New test compilable/deprecated_enum_member.d covers the anonymous-enum and
named-enum cases.


Split out of #23242 per review feedback. That PR (ImportC C23 [[...]] attributes)
is stacked on top of this one: its C23 enumerator-deprecation support makes a
deprecated ImportC enumerator fire this same diagnostic, so it depends on this dedup
to emit the message once rather than twice.

@thewilsonator

Copy link
Copy Markdown
Contributor

CI failures are network related.

…sed by name

A deprecated enum member accessed by its unqualified name (an anonymous
enum member, a member found via `with`, or an ImportC enumerator) reported
the deprecation twice: once during name resolution and again in getVarExp(),
which already performs the deprecated/disabled checks itself. Skip the
redundant check for enum members in the two name-resolution paths so the
diagnostic is emitted exactly once.
@PetarKirov

Copy link
Copy Markdown
Member Author

@thewilsonator I've expanded the test case. Can you review again?

@thewilsonator thewilsonator merged commit 544fa7d into dlang:master Jun 18, 2026
36 of 41 checks passed
@PetarKirov PetarKirov deleted the fix-23241-duplicate-deprecation branch June 18, 2026 18:45
@PetarKirov

Copy link
Copy Markdown
Member Author

tnx for the review, Nic!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate deprecation message when a deprecated enum member is accessed by name

2 participants