Skip to content
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

Scala Native 0.4.0 #752

Merged
merged 2 commits into from
Jan 22, 2021
Merged

Scala Native 0.4.0 #752

merged 2 commits into from
Jan 22, 2021

Conversation

gabro
Copy link
Contributor

@gabro gabro commented Jan 22, 2021

Patch to #751 to make it compile, it still crashes due to reflective instantiation of the test classes.

Stack trace

[error] scala.scalanative.testinterface.common.RPCCore$RPCException: java.lang.Exception: loadable module not found: org.scalacheck.NoPropertyNestingSpecification
[error] at scala.scalanative.testinterface.common.RPCCore.$anonfun$handleMessage$4(RPCCore.scala:66)
[error] at scala.Option.foreach(Option.scala:407)
[error] at scala.scalanative.testinterface.common.RPCCore.$anonfun$handleMessage$1(RPCCore.scala:64)
[error] at scala.scalanative.testinterface.common.RPCCore.$anonfun$handleMessage$1$adapted(RPCCore.scala:43)
[error] at scala.scalanative.testinterface.common.Serializer$.withInputStream(Serializer.scala:51)
[error] at scala.scalanative.testinterface.common.RPCCore.handleMessage(RPCCore.scala:43)
[error] at scala.scalanative.testinterface.NativeRunnerRPC.$anonfun$runner$1(NativeRunnerRPC.scala:29)
[error] at scala.scalanative.testinterface.NativeRunnerRPC.$anonfun$runner$1$adapted(NativeRunnerRPC.scala:29)
[error] at scala.scalanative.testinterface.ComRunner$$anon$1.run(ComRunner.scala:60)
[error] Caused by: java.lang.Exception: loadable module not found: org.scalacheck.NoPropertyNestingSpecification
[error] at java.lang.Throwable.fillInStackTrace(Unknown Source)
[error] at org.scalacheck.Platform$.$anonfun$loadModule$1(Unknown Source)
[error] at org.scalacheck.Platform$$$Lambda$1.apply(Unknown Source)
[error] at scala.Option.getOrElse(Unknown Source)
[error] at org.scalacheck.Platform$.loadModule(Unknown Source)
[error] at org.scalacheck.ScalaCheckRunner.rootTask(Unknown Source)

I'm a bit puzzled, since it looks like the test classes seem be erased at runtime, despite their superclass Properties being annotated with @EnableReflectiveInstantiation

@gabro gabro changed the base branch from master to topic/native-0.4 January 22, 2021 08:10
@gabro
Copy link
Contributor Author

gabro commented Jan 22, 2021

@larsrh
Copy link
Contributor

larsrh commented Jan 22, 2021

Wild speculation: maybe because most ScalaCheck tests are actually objects and not classes? Does the annotation also get applied to objects inheriting from Properties?

@gabro
Copy link
Contributor Author

gabro commented Jan 22, 2021

@larsrh It should. The loadModule API is specifically for loading module classes (aka objects).

FWIW it also fails with classes.

Notice that manually annotating all test classes/objects makes it work, but I don't think that's a viable solution.

@gabro
Copy link
Contributor Author

gabro commented Jan 22, 2021

The only caveats are about nesting those annotated objects/classes inside other classes or lambdas, but these are plain top-level objects/classes so it should just work.

Reading through the implementation seems to confirm this...

https://github.com/scala-native/scala-native/blob/895b3673ac1844d02e653f83d108ef5466c5e5d3/nscplugin/src/main/scala/scala/scalanative/nscplugin/NirGenStat.scala#L211-L219

@gabro
Copy link
Contributor Author

gabro commented Jan 22, 2021

@larsrh fixed! It was an issue with the fully qualified name which lacked the final $. Also, apparently now the arguments meant for the ScalaCheck runner need to be surrounded in quotes, or they will crash sbt's test-interface parser

@gabro gabro marked this pull request as ready for review January 22, 2021 09:07
@gabro
Copy link
Contributor Author

gabro commented Jan 22, 2021

Any god to pray to run the CI? It seems it didn't like my force push 😅

@larsrh larsrh closed this Jan 22, 2021
@larsrh larsrh reopened this Jan 22, 2021
@gabro
Copy link
Contributor Author

gabro commented Jan 22, 2021

@larsrh one option would be to merge (using the rebase option to keep the history linear) so that my commits end up onto your PR (I've already targeted the right branch).

Maybe that will wake the CI up

@larsrh larsrh merged commit c5a1a2a into typelevel:topic/native-0.4 Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants