[JVM IR] KTIJ-24206 Stub getters/setters of orphaned expect properties
- Property getters and setters are not marked as `isExpect` even if the corresponding property is. This commit fixes the generation of actual stubs for such functions.
This commit is contained in:
committed by
Space Team
parent
c9461a3827
commit
ba2e716682
+9
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||
@@ -77,6 +78,14 @@ private class StubOrphanedExpectSymbolTransformer(val stubGenerator: Declaration
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Property getters and setters are not marked as `isExpect` even if the corresponding property is. However, we still need to stub such
|
||||
* getters and setters, so [isTargetDeclaration] allows it.
|
||||
*/
|
||||
override fun isTargetDeclaration(declaration: IrDeclaration): Boolean =
|
||||
super.isTargetDeclaration(declaration) ||
|
||||
declaration is IrSimpleFunction && declaration.correspondingPropertySymbol?.owner?.isExpect == true
|
||||
|
||||
/**
|
||||
* If an `actual` symbol exists, we shouldn't stub the `expect` symbol. This will be performed by
|
||||
* [org.jetbrains.kotlin.backend.common.lower.ExpectDeclarationsRemoveLowering] during lowering.
|
||||
|
||||
Reference in New Issue
Block a user