Scala.JS: Cannot call lookupMethod(init___sc_Seq) on non Scala class sjs_js_Function

70 Views Asked by At

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

0

There are 0 best solutions below