https://kotlinlang.org logo
r

rnett

09/20/2020, 3:14 AM
Different problem now: everything compiles fine on JVM, but when I try to use it on JS, I get
java.lang.IllegalStateException: Not found Idx for public kotlin.collections/mapOf|5848051883920634516[0]
from the IrLinker. I'm referencing and using
mapOf(vararg Pair<>)
which works fine on JVM. The
compileKotlinJs
task works fine, it's the
compileProductionExecutableKotlinJs
task that fails. It's happening on other methods to. Seems to be just top level functions. Is this a known bug? Poking around in debug in
KotlinIrLinker.IrDeserializerForFile
, while the referenced function (in this case,
to
) isn't in
reversedSignitureIndex
, it is in
fileLocalDeserializationState.reachableTopLevels
, so it is obviously being found somehow.
r

Roman Artemev [JB]

09/20/2020, 9:00 AM
Could you please create an issue in YT with repro and short instruction
s

shikasd

09/20/2020, 1:38 PM
Hey, how do you reference those functions? Sometimes, if IR deserializer cannot find a function, the references could be a bit wrong. The signature you are seeing gets to reachableTopLevels through your reference, and then deserializer cannot find exact match for some reason. But anyways, it is worth creating an issue to make it a known bug ;)
r

Roman Artemev [JB]

09/20/2020, 2:16 PM
@shikasd yes, it is. It looks like a bug and has to be fixed but first I would prefer figure what exactly wrong out. The best to start so is create an issue 🙂
👍 1
r

rnett

09/20/2020, 8:03 PM
Yeah, I'll upload a sample project
👍 1
b

bnorm

09/21/2020, 8:18 PM
I ran into this a couple times and it had to do with the types used for the type parameters of the function. I was trying to use the types from the IrSimpleFunctionSymbol (something like
functionSymbol.owner.valueParameters[0]!!.type
) instead of building the IrType properly.
r

rnett

09/21/2020, 8:19 PM
yeah, I'm just now playing with it to make a sample project, and found that if I explicitly specify the return type of
to
in
irCall
, it works
r

Roman Artemev [JB]

09/22/2020, 8:47 AM
Yeah, specifying return type is kind of required because of in case of generic return type
fun <T> foo(): T
the actual return type is different from declaration’s one. So I think the solution here could be a bit friendly diagnostic.
r

rnett

09/22/2020, 5:39 PM
Yeah, although it worked fine on JVM without it
r

Roman Artemev [JB]

09/22/2020, 6:31 PM
JVM doesn’t use klibs so it is not affected.
2 Views