-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
schematic.StubSchematic can't be used in Scala.JS #34
Comments
I was taking a look at this earlier and I think I might be missing something. I created a javascript test with the contents: package schematic
object JavatimeSpec extends weaver.FunSuite {
object CompletionSchematic {
type Result[A] = List[String]
}
class CompletionSchematic extends StubSchematic[CompletionSchematic.Result] {
override def genericStruct[S](
fields: Vector[Field[CompletionSchematic.Result, S, _]]
)(const: Vector[Any] => S): CompletionSchematic.Result[S] = ???
def default[A]: List[String] = Nil
}
test("testing") {
val cs = new CompletionSchematic()
expect(cs.default == Nil)
}
} which seems to work without any compilation issues. The current js implementation of javatime looks like: package schematic
object javatime {
trait Syntax
type Schematic[F[_]] = Any
object Schematic {
trait Mixin[F[_]]
}
trait StubSchematic[F[_]] extends Schematic.Mixin[F] {}
} Anyway, more context here would be appreciated so I can reproduce this on my end |
Does that test run? I can compile all right, but In the meantime, I'll try to minimize this from my project... |
https://github.com/kubukoz/schematic-repro lazy val root = project
.in(file("."))
.enablePlugins(ScalaJSPlugin)
.settings(
scalaVersion := "2.13.7",
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) },
scalaJSUseMainModuleInitializer := true,
)
// Option #1 - pulls in core via %%
.enablePlugins(Smithy4sCodegenPlugin)
// Option #2
.settings(
libraryDependencies ++= Seq(
"com.disneystreaming.smithy4s" %%% "smithy4s-core" % "0.10.0"
)
) I think I see what's wrong, the codegen plugin is pulling in core via Anyway, removing the plugin-added dependency and using my own one seems to fix it, but I think this should be fixed in the plugin itself... |
Ah good catch, I will update that tomorrow |
I wonder if there's a way to have |
Yeah I don't think there is a way to do it. I chatted with @Baccata earlier and it seems like removing the core dependency from the plugin is probably the best path forward. I guess we could go the route of having a setting that can be overridden to prevent the core dependency from loading, but it seems like that sort of thing would cause more confusion than it would save since anyone using scala JS would have to be magically aware of it. Open to other ideas here though |
It breaks linking because of extending
javatime.StubSchematic
:The text was updated successfully, but these errors were encountered: