question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Linking error on Array() pattern with Scala.js 0.6.25 and Scala 2.13.0-M4

See original GitHub issue

Main.scala

package example

object Main {
  def main(args: Array[String]): Unit = {
    val Array(x, xs @ _*) = args
  }
}

build.sbt

scalaVersion := "2.13.0-M4"

enablePlugins(ScalaJSPlugin)

project/build.properties

sbt.version=1.2.1

project/plugins.sbt

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.25")

execute sbt fastOptJS

[error] Referring to non-existent method scala.Array$.unapplySeq(java.lang.Object)scala.Option
[error]   called from example.Main$.main([java.lang.String)scala.Unit
[error]   called from core module module initializers
[error] involving instantiated classes:
[error]   example.Main$
[error] org.scalajs.core.tools.linker.LinkingException: There were linking errors
[error] 	at org.scalajs.core.tools.linker.frontend.BaseLinker.linkInternal(BaseLinker.scala:160)
[error] 	at org.scalajs.core.tools.linker.frontend.BaseLinker.linkInternal(BaseLinker.scala:108)
[error] 	at org.scalajs.core.tools.linker.frontend.LinkerFrontend.$anonfun$link$3(LinkerFrontend.scala:63)
[error] 	at org.scalajs.core.tools.logging.Logger.time(Logger.scala:28)
[error] 	at org.scalajs.core.tools.logging.Logger.time$(Logger.scala:26)
[error] 	at org.scalajs.sbtplugin.Loggers$SbtLoggerWrapper.time(Loggers.scala:7)
[error] 	at org.scalajs.core.tools.linker.frontend.LinkerFrontend.link(LinkerFrontend.scala:62)
[error] 	at org.scalajs.core.tools.linker.Linker.$anonfun$link$1(Linker.scala:52)
[error] 	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] 	at org.scalajs.core.tools.linker.Linker.guard(Linker.scala:69)
[error] 	at org.scalajs.core.tools.linker.Linker.link(Linker.scala:50)
[error] 	at org.scalajs.core.tools.linker.ClearableLinker.$anonfun$link$1(ClearableLinker.scala:52)
[error] 	at org.scalajs.core.tools.linker.ClearableLinker.$anonfun$link$1$adapted(ClearableLinker.scala:52)
[error] 	at org.scalajs.core.tools.linker.ClearableLinker.linkerOp(ClearableLinker.scala:63)
[error] 	at org.scalajs.core.tools.linker.ClearableLinker.link(ClearableLinker.scala:52)
[error] 	at org.scalajs.sbtplugin.ScalaJSPluginInternal$.$anonfun$scalaJSStageSettings$11(ScalaJSPluginInternal.scala:315)
[error] 	at sbt.util.FileFunction$.$anonfun$cached$1(FileFunction.scala:73)
[error] 	at sbt.util.FileFunction$.$anonfun$cached$4(FileFunction.scala:147)
[error] 	at sbt.util.Difference.apply(Tracked.scala:313)
[error] 	at sbt.util.Difference.apply(Tracked.scala:293)
[error] 	at sbt.util.FileFunction$.$anonfun$cached$3(FileFunction.scala:143)
[error] 	at sbt.util.Difference.apply(Tracked.scala:313)
[error] 	at sbt.util.Difference.apply(Tracked.scala:288)
[error] 	at sbt.util.FileFunction$.$anonfun$cached$2(FileFunction.scala:142)
[error] 	at org.scalajs.sbtplugin.ScalaJSPluginInternal$.$anonfun$scalaJSStageSettings$10(ScalaJSPluginInternal.scala:320)
[error] 	at sbt.std.Transform$$anon$3.$anonfun$apply$2(System.scala:46)
[error] 	at sbt.std.Transform$$anon$4.work(System.scala:67)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] 	at sbt.Execute.work(Execute.scala:278)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:748)
[error] (Compile / fastOptJS) org.scalajs.core.tools.linker.LinkingException: There were linking errors

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sjrdcommented, Nov 27, 2018

@djspiewak Scala.js 0.6.26 is on its way to Maven Central, and includes this fix. Release notes will follow in the coming days.

1reaction
sjrdcommented, Sep 2, 2018

Ouch. So I made a mistake in 1a7f013641edd77dd427e05a50f9d38462fbd154. I did not realize that the changes to unapplySeq were binary-incompatible. I should have preserved a snapshot of the old overrides for 2.13.0-M4.

We can fix it, but the fix will probably never see the light of a release, because I don’t intend to keep supporting 2.13.0-M4 in future versions of Scala.js. The only reason 0.6.25 has it was to provide an upgrade path (SJS 0.6.24 w/ M4 -> SJS 0.6.25 w/ M4 -> SJS 0.6.25 w/ M5).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Linking Errors - Scala.js
Linking errors can have several root causes, which we detail here. The appropriate fix will depend on what the root cause is.
Read more >
Announcing Scala.js 0.6.29
a fix for a major bug in incremental compilation with sbt 1.x, and; a major performance improvement, notably for pattern matching. It also ......
Read more >
Semantics of Scala.js
toString of Float , Double and Unit. x.toString() returns slightly different results for floating point numbers and () ( Unit ).
Read more >
Standalone distribution - Scala.js
Scala.js 1.0.0 · 1.0.0, Scala 2.13 (tgz, 21MB) · 1.0.0, Scala 2.13 (zip, 21MB) · 1.0.0, Scala 2.12 (tgz, 27MB) · 1.0.0, Scala...
Read more >
Basic tutorial - Scala.js
enablePlugins(ScalaJSPlugin) name := "Scala.js Tutorial" scalaVersion := "2.13.1" // or any other Scala version >= 2.11.12 // This is an application with a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found