etorreborre/specs2

specs2 for scala-native 0.5 is broken

xuwei-k opened this issue · 5 comments

reproduce step

build.sbt

libraryDependencies += "org.specs2" %%% "specs2-core" % "4.20.6" % "test"

scalaVersion := "2.13.14"

enablePlugins(ScalaNativePlugin)

src/test/scala/ExampleSpec.scala

import org.specs2._

class ExampleSpec extends Specification {
  def is = s2"""
  example
  """
}

project/plugins.sbt

addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.1")

run sbt test

[error] java.util.concurrent.ExecutionException: Boxed Error
[error] 	at scala.concurrent.impl.Promise$.resolver(Promise.scala:97)
[error] 	at scala.concurrent.impl.Promise$.scala$concurrent$impl$Promise$$resolveTry(Promise.scala:89)
[error] 	at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:294)
[error] 	at scala.concurrent.Promise.complete(Promise.scala:53)
[error] 	at scala.concurrent.Promise.complete$(Promise.scala:52)
[error] 	at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:197)
[error] 	at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:42)
[error] 	at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:74)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[error] 	at java.base/java.lang.Thread.run(Thread.java:840)
[error] Caused by: java.lang.AssertionError: assertion failed: Can't read binary-incompatible version of NIR from 'Specs2Framework$SN$ReflectivelyInstantiate$.nir' (expected compat=6, got 5; expected revision=10, got 9).
[error] 	at scala.Predef$.assert(Predef.scala:223)
[error] 	at scala.scalanative.nir.serialization.Prelude$.readFrom(Prelude.scala:39)
[error] 	at scala.scalanative.linker.ClassPath$Impl.$anonfun$classesWithEntryPoints$1(ClassPath.scala:79)
[error] 	at scala.scalanative.linker.ClassPath$Impl.$anonfun$classesWithEntryPoints$1$adapted(ClassPath.scala:75)
[error] 	at scala.collection.TraversableLike.$anonfun$filterImpl$1(TraversableLike.scala:304)
[error] 	at scala.collection.mutable.HashMap.$anonfun$foreach$1(HashMap.scala:149)
[error] 	at scala.collection.mutable.HashTable.foreachEntry(HashTable.scala:237)
[error] 	at scala.collection.mutable.HashTable.foreachEntry$(HashTable.scala:230)
[error] 	at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:44)
[error] 	at scala.collection.mutable.HashMap.foreach(HashMap.scala:149)
[error] 	at scala.collection.TraversableLike.filterImpl(TraversableLike.scala:303)
[error] 	at scala.collection.TraversableLike.filterImpl$(TraversableLike.scala:297)
[error] 	at scala.collection.AbstractTraversable.filterImpl(Traversable.scala:108)
[error] 	at scala.collection.TraversableLike.filter(TraversableLike.scala:395)
[error] 	at scala.collection.TraversableLike.filter$(TraversableLike.scala:395)
[error] 	at scala.collection.AbstractTraversable.filter(Traversable.scala:108)
[error] 	at scala.scalanative.linker.ClassPath$Impl.classesWithEntryPoints$lzycompute(ClassPath.scala:75)
[error] 	at scala.scalanative.linker.ClassPath$Impl.classesWithEntryPoints(ClassPath.scala:74)
[error] 	at scala.scalanative.linker.ClassLoader$FromDisk.$anonfun$classesWithEntryPoints$1(ClassLoader.scala:32)
[error] 	at scala.collection.immutable.List.flatMap(List.scala:366)
[error] 	at scala.scalanative.linker.ClassLoader$FromDisk.classesWithEntryPoints$lzycompute(ClassLoader.scala:32)
[error] 	at scala.scalanative.linker.ClassLoader$FromDisk.classesWithEntryPoints(ClassLoader.scala:31)
[error] 	at scala.scalanative.linker.Reach.<init>(Reach.scala:59)
[error] 	at scala.scalanative.linker.Reach$.apply(Reach.scala:1166)
[error] 	at scala.scalanative.linker.Link$.apply(Link.scala:12)
[error] 	at scala.scalanative.build.ScalaNative$.$anonfun$link$3(ScalaNative.scala:45)
[error] 	at scala.scalanative.build.Logger.time(Logger.scala:36)
[error] 	at scala.scalanative.build.Logger.time$(Logger.scala:33)
[error] 	at scala.scalanative.build.Logger$$anon$3.time(Logger.scala:102)
[error] 	at scala.scalanative.build.ScalaNative$.$anonfun$link$1(ScalaNative.scala:45)
[error] 	at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:659)
[error] 	at scala.util.Success.$anonfun$map$1(Try.scala:255)
[error] 	at scala.util.Success.map(Try.scala:213)
[error] 	at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
[error] 	at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:42)
[error] 	at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:74)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[error] 	at java.base/java.lang.Thread.run(Thread.java:840)
[error] (Test / nativeLink) java.util.concurrent.ExecutionException: Boxed Error

@xuwei-k do you know how to fix that one? I haven't dug into Scala Native at all.

I put a call for volunteers on the #scala-native channel on the Scala Discord, perhaps some hero will swoop in

I took a look at the log above.

I suggest you contact @WojciechMazur and see if/when he can take a look at it.
Wojciech is probably the only one with the expertise to track it down in
finite time.

It's probably the same issue as with munit when some 0.4.x garbage file slipped into the 0.5.x artefacts scala-native/scala-native#3881 Working on a fix, would make a release after ensuring it fixes the bug

Fixed with specs2-4.20.9.