[IrActualizer] Don't actualize expect types

This was never semantically correct, but was not important
before KT-63644, as they were immediately dropped after that anyway.

After KT-63644, they were used to compute fake overrides inside them,
which were later matched against actual class, which can
produce false-positive matching errors.

^KT-64835
This commit is contained in:
Pavel Kunyavskiy
2024-01-09 10:23:34 +01:00
committed by Space Team
parent cf3672314a
commit 9374cacdd6
12 changed files with 88 additions and 0 deletions
@@ -95,6 +95,7 @@ internal open class ActualizerVisitor(private val symbolRemapper: SymbolRemapper
override fun visitClass(declaration: IrClass) =
declaration.also {
if (declaration.isExpect) return@also
it.superTypes = it.superTypes.map { superType -> superType.remapType() }
it.transformChildren(this, null)
it.transformAnnotations(declaration)
@@ -104,6 +105,7 @@ internal open class ActualizerVisitor(private val symbolRemapper: SymbolRemapper
}
override fun visitSimpleFunction(declaration: IrSimpleFunction) = (visitFunction(declaration) as IrSimpleFunction).also {
if (declaration.isExpect) return@also
it.overriddenSymbols = it.overriddenSymbols.memoryOptimizedMap { symbol ->
symbolRemapper.getReferencedFunction(symbol) as IrSimpleFunctionSymbol
}
@@ -113,6 +115,7 @@ internal open class ActualizerVisitor(private val symbolRemapper: SymbolRemapper
override fun visitFunction(declaration: IrFunction) =
declaration.also {
if (declaration.isExpect) return@also
it.returnType = it.returnType.remapType()
it.transformChildren(this, null)
it.transformAnnotations(declaration)
@@ -120,6 +123,7 @@ internal open class ActualizerVisitor(private val symbolRemapper: SymbolRemapper
override fun visitProperty(declaration: IrProperty) =
declaration.also {
if (declaration.isExpect) return@also
it.transformChildren(this, null)
it.overriddenSymbols = it.overriddenSymbols.memoryOptimizedMap { symbol ->
symbolRemapper.getReferencedProperty(symbol)