Binding.scala icon indicating copy to clipboard operation
Binding.scala copied to clipboard

Marcros not working (did add the compiler plugin)

Open rparree opened this issue 7 years ago • 5 comments

I have a working project to test drive some of the things i want to do in a larger application. Within this larger application i am not able to get macros to work. This is my project definition

lazy val frontApp = (project in file("clients/front-app")).
        enablePlugins(ScalaJSPlugin).
        settings(
            scalaVersion := "2.12.6",
            libraryDependencies ++= Seq(`scalajs-dom`.value, `binding.scala`.value, `binding.scala-future`.value),
            skip in packageJSDependencies := false,
            relativeSourceMaps := true,
            addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
        )

However it keeps coming back with the error that scala.xml.Elem is not equired: com.thoughtworks.binding.Binding[org.scalajs.dom.Node]

I am using bare minimum test code:

@JSExportTopLevel("Suggestions")
object FrontApp {


    @JSExport
    def main(): Unit = {
        dom.render(document.body, d)
    }

    @dom
    def d: Binding[Node] = {
        <div>hello</div>
    }
}

This code works in a separate project, but not inside my larger multi-project

rparree avatar Jun 11 '18 11:06 rparree

Ok there was something wrong with my imports:

This works:

import org.scalajs.dom.{Event, Node, document}
import com.thoughtworks.binding.{Binding, dom}

When i add

import com.thoughtworks.binding.dom

It no longer works.

rparree avatar Jun 11 '18 13:06 rparree

Not reproducible

Atry avatar Jun 11 '18 15:06 Atry

have a look at https://github.com/rparree/binding.scala-issue82

Open playfield/SampleApp.scala

Uncomment the line and try to do a fastOpsJS. With the line commented it works for me, with the line uncommented it breaks

rparree avatar Jun 11 '18 16:06 rparree

Interesting, I suspect there is an underlying bug in https://github.com/scalamacros/paradise

Atry avatar Jun 11 '18 16:06 Atry

i think so as well. have filed an issue there.

Thanks your framework rocks.

rparree avatar Jun 11 '18 16:06 rparree