Skip to content

Conflicting bounds error points to wrong opaque type in the same file #24218

@eejbyfeldt

Description

@eejbyfeldt

Compiler version

Fails on 3.7.3, 3.3.7 and 3.8.0-RC1-bin-20251021-3da7bb1-NIGHTLY

Minimized code

opaque type T >: Int = Int
opaque type O >: Int = Long

Output

[error] ./wrong_alias.scala:1:1
[error] the top-level definitions in package <empty> cannot be instantiated
[error] since it has a member O with possibly conflicting bounds Int | Long <: ... <: Long
[error] opaque type T >: Int = Int
[error] ^
Error compiling project (Scala 3.8.0-RC1-bin-20251021-3da7bb1-NIGHTLY, JVM (21))
Compilation failed

Expectation

The error should be pointing to opaque type O instead.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions