Skip to content

Erasure of tasty method with ValueOf[Int with Singleton] param #12259

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

Closed
bishabosha opened this issue Dec 7, 2020 · 2 comments · Fixed by scala/scala#9394
Closed

Erasure of tasty method with ValueOf[Int with Singleton] param #12259

bishabosha opened this issue Dec 7, 2020 · 2 comments · Fixed by scala/scala#9394
Assignees
Milestone

Comments

@bishabosha
Copy link
Member

bishabosha commented Dec 7, 2020

a method with a parameter of type ValueOf[I] where I <: Int will erase to java.lang.Integer and not java.lang.Object as the descriptor of Values.reify requires

reproduction steps

using Scala (2.13.4),

// compile with Scala 3.0.0-M2
object Values {
  def reify[I <: Int](implicit I: ValueOf[I]): I = valueOf[I]
}
// compile with Scala 2.13.4
object Test extends App {
  println(Values.reify[3])
}

problem

runtime error:

[error] Test scala.tools.tastytest.TastyTestJUnit.run failed: java.lang.NoSuchMethodError: tastytest.Values$.reify(Ljava/lang/Integer;)I, took 18.115 sec
[error]     at tastytest.TestValues$.$anonfun$new$1(TestValues.scala:8)
[error]     at tastytest.Suite.$anonfun$runImpl$2(Suite.scala:49)
[error]     at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
[error]     at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
[error]     at scala.collection.AbstractIterable.foreach(Iterable.scala:919)
[error]     at scala.collection.IterableOps$WithFilter.foreach(Iterable.scala:889)
[error]     at tastytest.Suite.runImpl(Suite.scala:48)
[error]     at tastytest.Suite.main(Suite.scala:40)
[error]     at tastytest.TestValues.main(TestValues.scala)
@bishabosha
Copy link
Member Author

I believe this is actually an issue on the dotty side, the descriptor for Values.reify is (Ljava/lang/Object;)I but in scala 2 would be (Ljava/lang/Integer;)I

@smarter
Copy link
Member

smarter commented Dec 12, 2020

This should be fixed by scala/scala3#10765.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants