Skip to content

Add ErrorMessageID to -Winfer-union warnings (#25073)#25249

Merged
tgodzik merged 1 commit intoscala:mainfrom
Binayak490-cyber:fix-25073-infer-union-warning-id
Feb 11, 2026
Merged

Add ErrorMessageID to -Winfer-union warnings (#25073)#25249
tgodzik merged 1 commit intoscala:mainfrom
Binayak490-cyber:fix-25073-infer-union-warning-id

Conversation

@Binayak490-cyber
Copy link
Copy Markdown
Contributor

Fixes #25073

Warnings emitted by -Winfer-union previously did not have an ErrorMessageID,
which meant they could not be configured using -Wconf.

This PR:

  • Introduces InferUnionWarningID
  • Adds structured InferUnionWarning message
  • Updates existing warn tests to include the ID
  • Adds a new warn test verifying the ID is printed
  • Adds a neg test verifying -Wconf:id=E225:error turns the warning into an error

All tests pass.

@Binayak490-cyber
Copy link
Copy Markdown
Contributor Author

Hi @Gedochao, @eejbyfeldt,
I've added an ErrorMessageID to the -Winfer-union warning as suggested in #25073.
Would appreciate your feedback.

Copy link
Copy Markdown
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM

@tgodzik tgodzik merged commit f9de300 into scala:main Feb 11, 2026
59 checks passed
@som-snytt som-snytt removed their request for review February 11, 2026 18:47
@WojciechMazur WojciechMazur added the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Feb 13, 2026
@WojciechMazur WojciechMazur added this to the 3.8.2 milestone Feb 13, 2026
WojciechMazur added a commit that referenced this pull request Feb 13, 2026
Fixes #25073

Warnings emitted by `-Winfer-union` previously did not have an
ErrorMessageID,
which meant they could not be configured using `-Wconf`.

This PR:
- Introduces `InferUnionWarningID`
- Adds structured `InferUnionWarning` message
- Updates existing warn tests to include the ID
- Adds a new warn test verifying the ID is printed
- Adds a neg test verifying `-Wconf:id=E225:error` turns the warning
into an error

All tests pass.
[Cherry-picked f9de300][modified]
@WojciechMazur WojciechMazur added backport:accepted This PR needs to be backported, once it's been backported replace this tag by "backport:done" and removed backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. labels Feb 13, 2026
WojciechMazur added a commit that referenced this pull request Feb 14, 2026
….8.2 (#25261)

Backports #25249 to the 3.8.2-RC3.

PR submitted by the release tooling.
[skip ci]
@WojciechMazur WojciechMazur added backport:done This PR was successfully backported. and removed backport:accepted This PR needs to be backported, once it's been backported replace this tag by "backport:done" labels Feb 14, 2026
tgodzik added a commit to scala/scala3-lts that referenced this pull request Feb 24, 2026
Fixes scala#25073

Warnings emitted by `-Winfer-union` previously did not have an
ErrorMessageID,
which meant they could not be configured using `-Wconf`.

This PR:
- Introduces `InferUnionWarningID`
- Adds structured `InferUnionWarning` message
- Updates existing warn tests to include the ID
- Adds a new warn test verifying the ID is printed
- Adds a neg test verifying `-Wconf:id=E225:error` turns the warning
into an error

All tests pass.
[Cherry-picked f9de300][modified]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:done This PR was successfully backported.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warnings from -Winfer-union does not have a error message id

3 participants