I'm generating a property in FIR that gets complet...
# compiler
j
I'm generating a property in FIR that gets completed later in IR. This property is annotated with
@Transient
from Kotlin Serialization. It seems that something has recently changed in Kotlin Serialization — perhaps the checker has been moved to FIR — because now I'm getting the following error:
Copy code
This property is marked as @Transient and therefore must have an initializing expression
I tried changing the order in which the plugins are applied, as I had a similar issue before with the AtomicFU plugin, but that workaround doesn’t work this time. I suppose creating a fake in FIR for that property would fix the issue, but since that’s not allowed, what other workaround could I use?
d
You can add a
null!!
initializer in FIR property
j
Will try, thanks! I have to manually create that initializer manually, or there is an utility function to get that?
d
You need to it create manually.
👍 1
🙏 1
j
Is it possible to use
FirStub
?
Copy code
atomicProperty.replaceInitializer(FirStub)
d
You can try, but I have a remembrance that it breaks fir2ir.
j
You are right:
Should not be here: class org.jetbrains.kotlin.fir.resolve.dfa.cfg.FirStub ??? class org.jetbrains.kotlin.fir.resolve.dfa.cfg.FirStub
This worked, thank you!
Copy code
replaceInitializer(
    buildErrorExpression { diagnostic = KopyConeTemporalDiagnostic }
)
👍 1
d
Probably it could be automatically added by the compiler. Could you please create a youtrack request for that?
j
Sure 🙂