Skip to content

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

@eejbyfeldt

Description

@eejbyfeldt

Compiler version

3.8.3-RC1-bin-20260123-506b8a0-NIGHTLY

Minimized example

Warning added in #24258 see tests for examples that gives warnings.

Output Error/Warning message

-- Warning: tests/warn/infer-or-type.scala:6:18 ------------------------------------------------------------------------
6 |  val _ = List(1).contains("") // warn
  |          ^^^^^^^^^^^^^^^^
  |          A type argument was inferred to be union type Int | String
  |          This may indicate a programming error.
-- Warning: tests/warn/infer-or-type.scala:7:10 ------------------------------------------------------------------------
7 |  val _ = Pair(1, "") // warn
  |          ^^^^
  |          A type argument was inferred to be union type Int | String
  |          This may indicate a programming error.

Why this Error/Warning was not helpful

The message was unhelpful because it does not have a error message id

Suggested improvement

It could be made more helpful by having a error message id.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:lintingLinting warnings enabled with -W or -Xlintarea:reportingError reporting including formatting, implicit suggestions, etcbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesitype:enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions