2

I get the following exception when sbt run in my scala.js - Binding.scala project:

[info] Fast optimizing /Users/..../client/target/scala-2.12/cms-adapters-general-client-fastopt.js
[error] java.lang.AssertionError: assertion failed: Cannot call lookupMethod(init___sc_Seq) on non Scala class sjs_js_Function
[error]     at scala.Predef$.assert(Predef.scala:219)
[error]     at org.scalajs.core.tools.linker.analyzer.Analyzer$ClassInfo.tryLookupMethod(Analyzer.scala:321)

This happens in this code:

<button class="ui basic icon button"
        onclick={_: Event =>
          if (jQuery(".ui.form").form("is valid").asInstanceOf[Boolean]) {
            val reader = new FileReader()
            reader.readAsDataURL(excelInput.files(0))
            reader.onload = (_: UIEvent) => {
              println("file loaded")
             }
          }
        }>Submit</button>

If I comment /*reader.onload = (_: UIEvent) => ... } */ it works.

There is no reference to any 'non Scala class'.

Even more strange - I have a project where the exact same code works - see DemoRunJobDialog

Edit: Found Problem/ Workaround

This is really strange. I took the working class from the other project and adjusted it step by step.

In the end it was the class-name!

This name worked:

case class ImportJobDialog(socket: ClientWebsocket)

This name worked NOT:

case class ExcelImportJobDialog(socket: ClientWebsocket)

Edit: I created an issue here: Binding.scala/issues/78

pme
  • 14,156
  • 3
  • 52
  • 95
  • 1
    That's a crash in the Scala.js linker, so it's either in bug in the macros of Binding.scala (because it produces invalid code) or in Scala.js itself. Statistically, when macros are at play, the bug is almost always in the macro (and not in Scala.js or the Scala compiler), so I suggest you report that as an issue to https://github.com/ThoughtWorksInc/Binding.scala/issues. – sjrd May 10 '18 at 09:24

0 Answers0