Nick
03/11/2024, 5:32 AMWebAssembly.instantiateStreaming(): Compiling function #17996:"io.nacular.doodle.layout.constraints.impl.Const..." failed: call[1] expected type (ref null 3131), found local.get of type (ref null 348) @+1486748
CompileError: WebAssembly.instantiateStreaming(): Compiling function #17996:"io.nacular.doodle.layout.constraints.impl.Const..." failed: call[1] expected type (ref null 3131), found local.get of type (ref null 348) @+1486748
i've narrowed it down to a trivial case:
simple app within src/wasmJsMain
import io.nacular.doodle.application.Application
import io.nacular.doodle.application.application
import io.nacular.doodle.core.Display
import io.nacular.doodle.core.view
import io.nacular.doodle.drawing.Color.Companion.Red
import io.nacular.doodle.drawing.paint
import io.nacular.doodle.geometry.Size
import io.nacular.doodle.layout.constraints.constrain
import io.nacular.doodle.layout.constraints.fill
import org.kodein.di.instance
class TestApp(display: Display): Application {
init {
display += view {
size = Size(100)
render = {
rect(bounds.atOrigin, fill = Red.paint)
}
}
display.layout = constrain(display.first(), fill) // this line pulls in the class that fails to compile
}
override fun shutdown() {
// no-op
}
}
fun main() {
application {
TestApp(instance())
}
}
build.gradle.kts
@file:OptIn(ExperimentalWasmDsl::class)
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
group = "org.example"
version = "1.0-SNAPSHOT"
plugins {
kotlin("multiplatform") version "2.0.0-Beta4"
}
repositories {
mavenCentral()
maven ("<https://oss.sonatype.org/content/repositories/snapshots>") // snapshots
mavenLocal ()
}
kotlin {
wasmJs {
compilations.all {
kotlinOptions {
moduleKind = "umd"
sourceMapEmbedSources = "always"
}
}
browser {
testTask { enabled = false }
}
binaries.executable()
}
sourceSets {
val doodleVersion = "0.11.0-SNAPSHOT"
commonMain.dependencies {
implementation("io.nacular.doodle:core:$doodleVersion")
}
val wasmJsMain by getting {
dependencies {
implementation("io.nacular.doodle:browser:$doodleVersion")
}
}
}
}
kirillrakhman
03/11/2024, 8:06 AMNick
03/12/2024, 7:32 AM