mirror of https://github.com/sbt/sbt.git
Try to reproduce Scala.js + macro bug
Ref https://github.com/sbt/sbt/issues/5427
This commit is contained in:
parent
f5bd0fd096
commit
a9e592996e
|
|
@ -0,0 +1,13 @@
|
|||
ThisBuild / scalaVersion := "2.13.1"
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
.aggregate(macroProvider, macroClient)
|
||||
|
||||
lazy val macroProvider = (project in file("macro-provider"))
|
||||
.settings(
|
||||
libraryDependencies += scalaVersion("org.scala-lang" % "scala-reflect" % _ ).value
|
||||
)
|
||||
|
||||
lazy val macroClient = (project in file("macro-client"))
|
||||
.enablePlugins(ScalaJSPlugin)
|
||||
.dependsOn(macroProvider)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package macros
|
||||
|
||||
object Client {
|
||||
Provider.tree(0)
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package macros
|
||||
|
||||
import scala.language.experimental.macros
|
||||
import scala.reflect.macros.blackbox
|
||||
import java.io.File
|
||||
|
||||
object Provider {
|
||||
def tree(args: Any): File = macro treeImpl
|
||||
def treeImpl(c: blackbox.Context)(args: c.Expr[Any]): c.Expr[File] = {
|
||||
import c.universe._
|
||||
c.Expr(q"""new java.io.File(".")""")
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package macros
|
||||
import scala.language.experimental.macros
|
||||
import scala.reflect.macros.blackbox
|
||||
|
||||
object Provider {
|
||||
def tree(args: Any): Any = macro treeImpl
|
||||
def treeImpl(c: blackbox.Context)(args: c.Expr[Any]) = sys.error("no macro for you!")
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.0")
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
# Marked as pending due to StackOverflow error, see
|
||||
# https://github.com/sbt/sbt/issues/1544 for details
|
||||
|
||||
> compile
|
||||
|
||||
# replace macro with one that throws an error
|
||||
|
||||
$ copy-file macro-provider/changes/Provider.scala macro-provider/Provider.scala
|
||||
|
||||
> macroProvider/compile
|
||||
|
||||
-> macroClient/compile
|
||||
|
||||
> clean
|
||||
|
||||
-> compile
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
scalaVersion := "2.12.3"
|
||||
enablePlugins(ScalaJSPlugin)
|
||||
libraryDependencies += "org.scala-js" %%% "scalajs-java-time" % "0.2.2"
|
||||
ThisBuild / scalaVersion := "2.13.1"
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
.enablePlugins(ScalaJSPlugin)
|
||||
.settings(
|
||||
libraryDependencies += "org.scala-js" %%% "scalajs-java-time" % "1.0.0"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.19")
|
||||
|
|
@ -0,0 +1 @@
|
|||
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.0")
|
||||
Loading…
Reference in New Issue