Skip to content

@alpha annotation on a class clashes with auto-generated companion object definition #7723

Closed
@panacekcz

Description

@panacekcz

In the code bellow, a default argument causes automatic generation of a companion object. This object seems to inherit the @alpha annotation from the class. Then, the annotations on the class and the object clash.

minimized code

@scala.annotation.alpha("A") class B(i: Int = 1)

output

1 |@scala.annotation.alpha("A") class B(i: Int = 1)
  |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |@alpha annotation "A" clashes with other definition is same scope

expectation

The companion object should be generated in such a way, that its definition does not clash with the class.

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