-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime java.lang.AbstractMethodError when combining opaque type erasure, value class erasure, and generic type erasure #17281
Labels
Comments
We need to minimize this example to not have a dependency on |
Here is a zero dependency repro: https://scastie.scala-lang.org/PKqpEimLRYOWZmbl72myFw |
@nicolasstucki does this need more information? |
Tested with |
Further minimization: type IO[T] = T
opaque type NonNegLong = Long
object NonNegLong {
def apply(l: Long): NonNegLong = l
}
class Baz(value: NonNegLong) extends AnyVal
trait InnerThing[F[_]] {
def withBaz(baz: Baz): F[Unit]
}
class InnerThingImpl extends InnerThing[IO] {
override def withBaz(baz: Baz): IO[Unit] = println("withBaz")
}
object Test {
def main(args: Array[String]): Unit = {
val testInnerImpl: InnerThing[IO] = new InnerThingImpl
println("Hello")
val nnl = new Baz(NonNegLong(1L))
testInnerImpl.withBaz(nnl)
println("Goodbye")
}
}
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
3.3.0
Minimized code
https://scastie.scala-lang.org/B5fP4EPnSJeMRIsI84IeQQ
Output
With excaption
Expectation
No
AbstractMethodError
. This works as expected if you do any one of:extends AnyVal
: https://scastie.scala-lang.org/5HMeaYKDQACRXp3r3LomlQF[_]
parameter: https://scastie.scala-lang.org/YDBOeM5zQ3WjUK36mvCPOgThe text was updated successfully, but these errors were encountered: