You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Doubledefinition:
deffoo(ps: String*):Unit in packageobjectmain$package at line 4 and
deffoo(ps: Int*):Unit in packageobjectmain$package at line 5
have the same typeafter erasure.
@alpha("fooAny") deffoo(ps: Any*) :Unit=???Doubledefinition:
deffoo(ps: Int*):Unit in packageobjectmain$package at line 5 and
deffoo(ps: Any*):Unit in packageobjectmain$package at line 6
have the same typeafter erasure.
Currently DummyImplicit is used as a workaround to create unique signatures after erasure. @oderskymentioned 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.
The text was updated successfully, but these errors were encountered:
I tried to just remove the error condition but then we run into more trouble:
-- Error: i7942.scala:2:0 ------------------------------------------------------
2 |@alpha("fooString") def foo(ps: String*) : Unit = ???
|^
|cannot merge
| method foo of type (ps: Seq[Any]): Unit and
| method foo of type (ps: Seq[Int]): Unit
|they are both defined in package <empty> but have matching signatures
| (ps: Seq[Any]): Unit and
| (ps: Seq[Int]): Unit
|as members of package object i7942$package
|
3 |@alpha("fooInt") def foo(ps: Int*) : Unit = ???
4 |@alpha("fooAny") def foo(ps: Any*) : Unit = ???
To fix this we need to change our way how we treat signatures. Since signatures are used for many different things this will require a lot of thought.
minimized code
Compilation output
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.The text was updated successfully, but these errors were encountered: