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
The following is minimized code from my Scala3 migration attempt of twitter/util.
traitTimeLike[This<:TimeLike[This]]
traitTimeLikeOps[This<:TimeLike[This]] {
deffromMilliseconds(milliseconds: Long):ThisdeffromSeconds(seconds: Long):This= fromMilliseconds(seconds *1000L)
}
sealedclassDuration(valmilliseconds:Long) extendsTimeLike[Duration]
objectDurationextendsTimeLikeOps[Duration] {
deffromMilliseconds(milliseconds: Long):Duration=newDuration(milliseconds)
// note that this override was already a workaround for calling Scala2 from Java. For pure Scala it's not needed.overridedeffromSeconds(seconds: Long):Duration=super.fromSeconds(seconds)
}
Then trying to call the overridden method from Java causes a compile-error:
reference to fromSeconds is ambiguous
both method fromSeconds(long) in twitter.Duration and method fromSeconds(long) in twitter.DurationmatchDuration.fromSeconds
Expectation
It should compile as it did in 2.13.6 and earlier.
Cheers
~ Felix
The text was updated successfully, but these errors were encountered:
Static forwarders for bridges lead to ambiguous errors in some Java
compilers, and the trait setters aren't meant to be called by users.
Since we can't remove them without breaking binary-compatibility, we
mark them ACC_SYNTHETIC so that Java compilers will ignore them. See
also the discussion in scala#12767 which implements an alternate fix.
Fixesscala#12753.
Co-Authored-By: Lukas Rytz <[email protected]>
Compiler version
3.0.0 (it compiles fine with 2.13.6 and earlier)
Minimized code
The following is minimized code from my Scala3 migration attempt of
twitter/util
.Then trying to call the overridden method from Java causes a compile-error:
If you want to run the code, here's a runnable branch/commit: felixbr/scala3-example-project@e23ffcf
Output
Expectation
It should compile as it did in 2.13.6 and earlier.
Cheers
~ Felix
The text was updated successfully, but these errors were encountered: