Skip to content

@alpha has no effect over double definition error #7942

Closed
@soronpo

Description

@soronpo

minimized code

import scala.annotation.alpha
@alpha("fooString") def foo(ps: String*) : Unit = ???
@alpha("fooInt") def foo(ps: Int*) : Unit = ???
@alpha("fooAny") def foo(ps: Any*) : Unit = ???
Compilation output
Double definition:
def foo(ps: String*): Unit in package object main$package at line 4 and
def foo(ps: Int*): Unit in package object main$package at line 5
have the same type after erasure.
@alpha("fooAny") def foo(ps: Any*) : Unit = ???

Double definition:
def foo(ps: Int*): Unit in package object main$package at line 5 and
def foo(ps: Any*): Unit in package object main$package at line 6
have the same type after erasure.

see scastie: https://scastie.scala-lang.org/owQEIEShQayiRjUJ6Esk2w

expectation

Currently DummyImplicit is used as a workaround to create unique signatures after erasure.
@odersky mentioned that @alpha annotation could be used to avoid double definition error, however it does not seem to affect the compiler when it checks for double definitions.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions