IR: do not visit function body at all in IrFakeOverrideBuilder
This change fixes FIR tests with JVM IR serialization enabled, some of which start to fail after enabling IR fake override builder mode by default. In this case, even accessing the function body with `IrFunction.body` does not work in some cases because it tries to load IR and ends up with unbound symbols for some reason (most likely related to KT-63509). So we avoid accessing the body by copying the `IrFunction.acceptChildren` implementation and removing the `body.accept` call. Using deep-copy to create a fake override is questionable here, but it will need to be refactored separately.
This commit is contained in:
committed by
Space Team
parent
0b78cf9aa3
commit
b88ce50500
+10
@@ -110,6 +110,16 @@ class CopyIrTreeWithSymbolsForFakeOverrides(
|
||||
override fun visitBlockBody(body: IrBlockBody) {} // don't visit function body and parameter default values
|
||||
override fun visitExpressionBody(body: IrExpressionBody) {} // don't visit function body and parameter default values
|
||||
|
||||
override fun visitSimpleFunction(declaration: IrSimpleFunction, data: Nothing?) {
|
||||
// In case of FIR tests with JVM IR serialization enabled, even accessing the function body with `IrFunction.body` does not work
|
||||
// in some cases because it tries to load IR and ends up with unbound symbols for some reason (most likely related to KT-63509).
|
||||
// So we avoid accessing the body by copying the `IrFunction.acceptChildren` implementation and removing the `body.accept` call.
|
||||
declaration.typeParameters.forEach { it.accept(this, data) }
|
||||
declaration.dispatchReceiverParameter?.accept(this, data)
|
||||
declaration.extensionReceiverParameter?.accept(this, data)
|
||||
declaration.valueParameters.forEach { it.accept(this, data) }
|
||||
}
|
||||
|
||||
override fun getReferencedClassifier(symbol: IrClassifierSymbol): IrClassifierSymbol {
|
||||
val result = super.getReferencedClassifier(symbol)
|
||||
if (result !is IrTypeParameterSymbol)
|
||||
|
||||
Reference in New Issue
Block a user