I have an FIR generator that generates a declarati...
# compiler
z
I have an FIR generator that generates a declaration that extends a defined interface, but finding that IR deserialization of its fake overrides fails on non-JVM targets when trying to compile test sources that access this type. Is there anything we should do with fake overrides to avoid this? Example (in src/commonMain/kotlin)
Copy code
interface Example {
  fun example2(): Example2 // Some class

  // Generated class
  class $$GeneratedClass : Example
}
The compileKotlinJs task completes successfully, but the following failure happens during test compilation. If I breakpoint, it's on the fake override of
example2()
Copy code
> Task :sample:compileTestDevelopmentExecutableKotlinJs FAILED
e: java.lang.IllegalStateException: IrValueParameterSymbolImpl is already bound. Signature: null. Owner: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<uninitialized parent>.$$GeneratedClass
        at org.jetbrains.kotlin.ir.symbols.impl.IrSymbolBase.bind(IrSymbolImpl.kt:67)
        at org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl.<init>(IrValueParameterImpl.kt:48)
        at org.jetbrains.kotlin.ir.declarations.IrFactory.createValueParameter(IrFactory.kt:407)
        at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.deserializeIrValueParameter(IrDeclarationDeserializer.kt:298)
        at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.deserializeIrValueParameter$default(IrDeclarationDeserializer.kt:294)
        at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer$withDeserializedIrFunctionBase$1$1$1$1.invoke(IrDeclarationDeserializer.kt:542)
        at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer$withDeserializedIrFunctionBase$1$1$1$1.invoke(IrDeclarationDeserializer.kt:539)
        at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.withBodyGuard(IrDeclarationDeserializer.kt:482)
Happens with seemingly every non-jvm target, tested with js, wasmJs, macosArm64, etc. There's nowhere that the test code directly touches the generated class, but it does indirectly via generated creator function that it does invoke. If I comment out all indirect references, the test compilation succeeds.
d
Sounds like a bug Can you share the reproducer?
z
I’ll see if I can make a public one
(shared privately!)
thank you color 1