yeah, I need some playground apps to help reproduc...
# koin
a
yeah, I need some playground apps to help reproduce 👍
j
I noticed it when I passed the
@Single provideHttpClient(json: Json): HttpClient = ....
it stopped working, but it is also doable with simpler objects. So if I have an ExampleObject interface, and I pass the DefaultExampleObject to either a constructor or a module function it doesn't like it, however if I pass the interface it is okay.
Copy code
interface ExampleObject {
    fun getString(): String
}

@Single(binds = [DefaultExampleObject::class, ExampleObject::class])
class DefaultExampleObject() : ExampleObject {

    override fun getString(): String {
        return "I am a string"
    }

}

@Module
@Configuration
@ComponentScan
class ExampleModule {

    @Single
    fun brokenDefaultExampleObject(exampleObject: DefaultExampleObject): Int = 5

    @Single
    fun correctExampleObject(exampleObject: ExampleObject): String = exampleObject.getString()
}
so with this code I get the error: wasm validation error: at offset 11801583: type mismatch: expression has type (ref null 11) but expected (ref null 27796)
Also I could remove the binds = [...] and result would be the same
And another one. If I have a nullable parameter, I get a similar error:
@InjectedParam private val someId: SomeId?
The epic workaround is to do this:
@InjectedParam private val someId: () -> SomeId?
and then
parametersOf({ myId })
a
Yeah not great. Need to see that from ground, confirming limitation for Kotlin Compiler part 🤔
j