diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index 467d758cfbd..668dca6fb54 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -288,10 +288,10 @@ class CallAndReferenceGenerator( val startOffset = adapteeFunction.startOffset val endOffset = adapteeFunction.endOffset val type = adapteeFunction.returnType - val irCall = - if (adapteeSymbol is IrConstructorSymbol) { + val irCall = when (adapteeSymbol) { + is IrConstructorSymbol -> IrConstructorCallImpl.fromSymbolOwner(startOffset, endOffset, type, adapteeSymbol) - } else { + is IrSimpleFunctionSymbol -> IrCallImpl( startOffset, endOffset, @@ -302,7 +302,9 @@ class CallAndReferenceGenerator( origin = null, superQualifierSymbol = null ) - } + else -> + error("unknown callee kind: ${adapteeFunction.render()}") + } if (boundDispatchReceiver != null || boundExtensionReceiver != null) { val receiverValue = IrGetValueImpl( diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt index 58e1761ac5d..5a417243b9f 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt @@ -341,7 +341,7 @@ open class DefaultParameterInjector( return visitFunctionAccessExpression(expression) { with(expression) { IrCallImpl( - startOffset, endOffset, type, it, + startOffset, endOffset, type, it as IrSimpleFunctionSymbol, typeArgumentsCount = typeArgumentsCount, valueArgumentsCount = it.owner.valueParameters.size, origin = DEFAULT_DISPATCH_CALL, diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt index 4604ae0aac4..361ff78f045 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt @@ -509,7 +509,7 @@ class LocalDeclarationsLowering( rewriteFunctionBody(irElement, null) } - private fun createNewCall(oldCall: IrCall, newCallee: IrFunction) = + private fun createNewCall(oldCall: IrCall, newCallee: IrSimpleFunction) = IrCallImpl( oldCall.startOffset, oldCall.endOffset, newCallee.returnType, diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/FunctionInlining.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/FunctionInlining.kt index 4f9a1fb96b5..f1c8e9afff1 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/FunctionInlining.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/FunctionInlining.kt @@ -234,17 +234,22 @@ class FunctionInlining( } val immediateCall = with(expression) { - if (function is IrConstructor) { - val classTypeParametersCount = function.parentAsClass.typeParameters.size - IrConstructorCallImpl.fromSymbolOwner( - startOffset, - endOffset, - function.returnType, - function.symbol, - classTypeParametersCount - ) - } else - IrCallImpl(startOffset, endOffset, function.returnType, functionArgument.symbol) + when (function) { + is IrConstructor -> { + val classTypeParametersCount = function.parentAsClass.typeParameters.size + IrConstructorCallImpl.fromSymbolOwner( + startOffset, + endOffset, + function.returnType, + function.symbol, + classTypeParametersCount + ) + } + is IrSimpleFunction -> + IrCallImpl(startOffset, endOffset, function.returnType, function.symbol) + else -> + error("Unknown function kind : ${function.render()}") + } }.apply { for (parameter in functionParameters) { val argument = diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ir/IrBuilder.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ir/IrBuilder.kt index 8f568fc2ce3..25183a4a914 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ir/IrBuilder.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ir/IrBuilder.kt @@ -21,7 +21,7 @@ object JsIrBuilder { object SYNTHESIZED_STATEMENT : IrStatementOriginImpl("SYNTHESIZED_STATEMENT") object SYNTHESIZED_DECLARATION : IrDeclarationOriginImpl("SYNTHESIZED_DECLARATION") - fun buildCall(target: IrFunctionSymbol, type: IrType? = null, typeArguments: List? = null): IrCall { + fun buildCall(target: IrSimpleFunctionSymbol, type: IrType? = null, typeArguments: List? = null): IrCall { val owner = target.owner return IrCallImpl( UNDEFINED_OFFSET, diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CallableReferenceLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CallableReferenceLowering.kt index 9509b3e6b33..44de8ad3a2a 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CallableReferenceLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CallableReferenceLowering.kt @@ -22,10 +22,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.types.IrSimpleType import org.jetbrains.kotlin.ir.types.IrTypeProjection import org.jetbrains.kotlin.ir.types.classOrNull -import org.jetbrains.kotlin.ir.util.defaultType -import org.jetbrains.kotlin.ir.util.explicitParameters -import org.jetbrains.kotlin.ir.util.isSuspend -import org.jetbrains.kotlin.ir.util.parentAsClass +import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.name.Name @@ -220,10 +217,30 @@ class CallableReferenceLowering(private val context: CommonBackendContext) : Bod private fun IrSimpleFunction.buildInvoke(): IrFunctionAccessExpression { val callee = function val irCall = reference.run { - if (callee is IrConstructor) { - IrConstructorCallImpl(startOffset, endOffset, callee.parentAsClass.defaultType, callee.symbol, callee.typeParameters.size, 0 /* TODO */, callee.valueParameters.size, CALLABLE_REFERENCE_INVOKE) - } else { - IrCallImpl(startOffset, endOffset, callee.returnType, callee.symbol, callee.typeParameters.size, callee.valueParameters.size, CALLABLE_REFERENCE_INVOKE) + when (callee) { + is IrConstructor -> + IrConstructorCallImpl( + startOffset, + endOffset, + callee.parentAsClass.defaultType, + callee.symbol, + callee.typeParameters.size, + 0 /* TODO */, + callee.valueParameters.size, + CALLABLE_REFERENCE_INVOKE + ) + is IrSimpleFunction -> + IrCallImpl( + startOffset, + endOffset, + callee.returnType, + callee.symbol, + callee.typeParameters.size, + callee.valueParameters.size, + CALLABLE_REFERENCE_INVOKE + ) + else -> + error("unknown function kind: ${callee.render()}") } } diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CreateScriptFunctionsPhase.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CreateScriptFunctionsPhase.kt index fef1e1f3cc5..dc399ea1044 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CreateScriptFunctionsPhase.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CreateScriptFunctionsPhase.kt @@ -121,7 +121,7 @@ class CreateScriptFunctionsPhase(val context: CommonBackendContext) : FileLoweri ) } - private fun createCall(function: IrFunction): IrCall { + private fun createCall(function: IrSimpleFunction): IrCall { return IrCallImpl( UNDEFINED_OFFSET, UNDEFINED_OFFSET, function.returnType, function.symbol, diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/calls/CallsLoweringUtils.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/calls/CallsLoweringUtils.kt index 25dd02d5b13..4fe7bb0ac8f 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/calls/CallsLoweringUtils.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/calls/CallsLoweringUtils.kt @@ -5,19 +5,19 @@ package org.jetbrains.kotlin.ir.backend.js.lower.calls -import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.util.irCall import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.types.SimpleType typealias SymbolToTransformer = MutableMap IrExpression> -internal fun SymbolToTransformer.add(from: Map, to: IrFunctionSymbol) { +internal fun SymbolToTransformer.add(from: Map, to: IrSimpleFunctionSymbol) { from.forEach { _, func -> add(func, to) } @@ -33,7 +33,7 @@ internal fun SymbolToTransformer.add(from: IrFunctionSymbol, to: (IrFunctionAcce put(from, to) } -internal fun SymbolToTransformer.add(from: IrFunctionSymbol, to: IrFunctionSymbol, dispatchReceiverAsFirstArgument: Boolean = false) { +internal fun SymbolToTransformer.add(from: IrFunctionSymbol, to: IrSimpleFunctionSymbol, dispatchReceiverAsFirstArgument: Boolean = false) { put(from) { call -> irCall(call, to, dispatchReceiverAsFirstArgument) } } @@ -47,11 +47,11 @@ internal fun MutableMap IrExpression>.add internal typealias MemberToTransformer = HashMap IrExpression> -internal fun MemberToTransformer.add(type: IrType, name: Name, v: IrFunctionSymbol) { +internal fun MemberToTransformer.add(type: IrType, name: Name, v: IrSimpleFunctionSymbol) { add(type, name) { irCall(it, v, receiversAsArguments = true) } } -internal fun MemberToTransformer.add(type: IrType, name: Name, v: IrFunction) { +internal fun MemberToTransformer.add(type: IrType, name: Name, v: IrSimpleFunction) { add(type, name, v.symbol) } diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/calls/NumberOperatorCallsTransformer.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/calls/NumberOperatorCallsTransformer.kt index d7d3937a208..f049d25527f 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/calls/NumberOperatorCallsTransformer.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/calls/NumberOperatorCallsTransformer.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.util.irCall import org.jetbrains.kotlin.name.Name @@ -117,7 +118,7 @@ class NumberOperatorCallsTransformer(context: JsIrBackendContext) : CallsTransfo private fun irBinaryOp( call: IrFunctionAccessExpression, - intrinsic: IrFunctionSymbol, + intrinsic: IrSimpleFunctionSymbol, toInt32: Boolean = false ): IrExpression { val newCall = irCall(call, intrinsic, receiversAsArguments = true) @@ -170,7 +171,7 @@ class NumberOperatorCallsTransformer(context: JsIrBackendContext) : CallsTransfo private fun transformDecrement(call: IrFunctionAccessExpression) = transformCrement(call, intrinsics.jsMinus) - private fun transformCrement(call: IrFunctionAccessExpression, correspondingBinaryOp: IrFunctionSymbol): IrExpression { + private fun transformCrement(call: IrFunctionAccessExpression, correspondingBinaryOp: IrSimpleFunctionSymbol): IrExpression { val operation = irCall(call, correspondingBinaryOp, receiversAsArguments = true).apply { putValueArgument(1, buildInt(1)) } @@ -262,7 +263,7 @@ class NumberOperatorCallsTransformer(context: JsIrBackendContext) : CallsTransfo } } - fun IrFunctionSymbol.call(vararg arguments: IrExpression) = + fun IrSimpleFunctionSymbol.call(vararg arguments: IrExpression) = JsIrBuilder.buildCall(this, owner.returnType).apply { for ((idx, arg) in arguments.withIndex()) { putValueArgument(idx, arg) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmBackendContext.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmBackendContext.kt index 9f89eea03e5..471c2d3cd43 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmBackendContext.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmBackendContext.kt @@ -101,7 +101,7 @@ class JvmBackendContext( internal val multifileFacadesToAdd = mutableMapOf>() val multifileFacadeForPart = mutableMapOf() internal val multifileFacadeClassForPart = mutableMapOf() - internal val multifileFacadeMemberToPartMember = mutableMapOf() + internal val multifileFacadeMemberToPartMember = mutableMapOf() internal val hiddenConstructors = mutableMapOf() @@ -117,7 +117,7 @@ class JvmBackendContext( val suspendFunctionOriginalToView = mutableMapOf() val fakeContinuation: IrExpression = createFakeContinuation(this) - val staticDefaultStubs = mutableMapOf() + val staticDefaultStubs = mutableMapOf() val inlineClassReplacements = MemoizedInlineClassReplacements(state.functionsWithInlineClassReturnTypesMangled, irFactory) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrUtils.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrUtils.kt index de81ef14ebb..75c41e9c48b 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrUtils.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/IrUtils.kt @@ -268,7 +268,11 @@ fun IrBody.replaceThisByStaticReference( fun createPlaceholderAnyNType(irBuiltIns: IrBuiltIns): IrType = irBuiltIns.anyNType -fun createDelegatingCallWithPlaceholderTypeArguments(existingCall: IrCall, redirectTarget: IrFunction, irBuiltIns: IrBuiltIns): IrCall = +fun createDelegatingCallWithPlaceholderTypeArguments( + existingCall: IrCall, + redirectTarget: IrSimpleFunction, + irBuiltIns: IrBuiltIns +): IrCall = IrCallImpl( existingCall.startOffset, existingCall.endOffset, diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/GenerateMultifileFacades.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/GenerateMultifileFacades.kt index 3d16fc99d9a..5abc2a21622 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/GenerateMultifileFacades.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/GenerateMultifileFacades.kt @@ -47,7 +47,7 @@ internal val generateMultifileFacadesPhase = makeCustomPhase - val functionDelegates = mutableMapOf() + val functionDelegates = mutableMapOf() // In -Xmultifile-parts-inherit mode, instead of generating "bridge" methods in the facade which call into parts, // we construct an inheritance chain such that all part members are present as fake overrides in the facade. @@ -89,7 +89,7 @@ private fun generateMultifileFacades( module: ModuleDescriptor, context: JvmBackendContext, shouldGeneratePartHierarchy: Boolean, - functionDelegates: MutableMap + functionDelegates: MutableMap ): List = context.multifileFacadesToAdd.map { (jvmClassName, partClasses) -> val kotlinPackageFqName = partClasses.first().fqNameWhenAvailable!!.parent() @@ -250,7 +250,7 @@ private fun IrSimpleFunction.createMultifileDelegateIfNeeded( } private class UpdateFunctionCallSites( - private val functionDelegates: MutableMap + private val functionDelegates: MutableMap ) : FileLoweringPass, IrElementTransformer { override fun lower(irFile: IrFile) { irFile.transformChildren(this, null) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt index 4281e66d038..62ee6f67331 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt @@ -21,8 +21,8 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrFunctionReference import org.jetbrains.kotlin.ir.expressions.IrReturn import org.jetbrains.kotlin.ir.expressions.impl.* -import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrLocalDelegatedPropertySymbol +import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.types.defaultType import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid @@ -36,7 +36,7 @@ import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid */ internal class InterfaceLowering(val context: JvmBackendContext) : IrElementTransformerVoid(), ClassLoweringPass { - private val removedFunctions = hashMapOf() + private val removedFunctions = hashMapOf() override fun lower(irClass: IrClass) { if (!irClass.isJvmInterface) return @@ -199,7 +199,7 @@ internal class InterfaceLowering(val context: JvmBackendContext) : IrElementTran // Bridge from static to static method - simply fill the function arguments to the parameters. // By nature of the generation of both source and target of bridge, they line up. - private fun IrFunction.bridgeToStatic(callTarget: IrFunction) { + private fun IrFunction.bridgeToStatic(callTarget: IrSimpleFunction) { body = IrExpressionBodyImpl(IrCallImpl(startOffset, endOffset, returnType, callTarget.symbol).also { call -> callTarget.typeParameters.forEachIndexed { i, _ -> @@ -214,7 +214,7 @@ internal class InterfaceLowering(val context: JvmBackendContext) : IrElementTran // Bridge from static DefaultImpl method to the interface method. Arguments need to // be shifted in presence of dispatch and extension receiver. - private fun IrFunction.bridgeViaAccessorTo(callTarget: IrFunction) { + private fun IrFunction.bridgeViaAccessorTo(callTarget: IrSimpleFunction) { body = IrExpressionBodyImpl( IrCallImpl( startOffset, diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmOverloadsAnnotationLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmOverloadsAnnotationLowering.kt index 3b8121eaea3..70e7c30551a 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmOverloadsAnnotationLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmOverloadsAnnotationLowering.kt @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.ir.types.defaultType import org.jetbrains.kotlin.ir.util.allTypeParameters import org.jetbrains.kotlin.ir.util.deepCopyWithSymbols import org.jetbrains.kotlin.ir.util.hasAnnotation +import org.jetbrains.kotlin.ir.util.render import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_OVERLOADS_FQ_NAME internal val jvmOverloadsAnnotationPhase = makeIrFilePhase( @@ -55,10 +56,14 @@ private class JvmOverloadsAnnotationLowering(val context: JvmBackendContext) : C private fun generateWrapper(target: IrFunction, numDefaultParametersToExpect: Int): IrFunction { val wrapperIrFunction = context.irFactory.generateWrapperHeader(target, numDefaultParametersToExpect) - val call = if (target is IrConstructor) - IrDelegatingConstructorCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.unitType, target.symbol) - else - IrCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, target.returnType, target.symbol) + val call = when (target) { + is IrConstructor -> + IrDelegatingConstructorCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.unitType, target.symbol) + is IrSimpleFunction -> + IrCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, target.returnType, target.symbol) + else -> + error("unknown function kind: ${target.render()}") + } for (arg in wrapperIrFunction.allTypeParameters) { call.putTypeArgument(arg.index, arg.defaultType) } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStandardLibraryBuiltInsLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStandardLibraryBuiltInsLowering.kt index bcd34f48449..5e4411b1fa8 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStandardLibraryBuiltInsLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStandardLibraryBuiltInsLowering.kt @@ -13,7 +13,7 @@ import org.jetbrains.kotlin.ir.declarations.IrFile import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl -import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.util.fqNameForIrSerialization import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid @@ -59,7 +59,7 @@ class JvmStandardLibraryBuiltInsLowering(val context: JvmBackendContext) : FileL // Originals are so far only instance methods, and the replacements are // statics, so we copy dispatch receivers to a value argument if needed. - private fun IrCall.replaceWithCallTo(replacement: IrFunctionSymbol) = + private fun IrCall.replaceWithCallTo(replacement: IrSimpleFunctionSymbol) = IrCallImpl( startOffset, endOffset, diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ResolveInlineCalls.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ResolveInlineCalls.kt index 652406e282f..b4b7ffd8835 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ResolveInlineCalls.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/ResolveInlineCalls.kt @@ -60,7 +60,7 @@ class ResolveInlineCalls(val context: JvmBackendContext) : IrElementTransformerV }) } - private fun IrFunction.resolveMultiFileFacades(): IrFunction? = + private fun IrFunction.resolveMultiFileFacades(): IrSimpleFunction? = if (origin == JvmLoweredDeclarationOrigin.MULTIFILE_BRIDGE) { context.multifileFacadeMemberToPartMember[this] } else null diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/StaticDefaultFunctionLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/StaticDefaultFunctionLowering.kt index aa554bb5add..8d5db3483e5 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/StaticDefaultFunctionLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/StaticDefaultFunctionLowering.kt @@ -25,10 +25,7 @@ import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase import org.jetbrains.kotlin.backend.common.phaser.then import org.jetbrains.kotlin.backend.jvm.JvmBackendContext import org.jetbrains.kotlin.ir.IrStatement -import org.jetbrains.kotlin.ir.declarations.IrClass -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrFile -import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrReturn @@ -63,7 +60,7 @@ private class StaticDefaultFunctionLowering(val context: JvmBackendContext) : Ir irClass.accept(this, null) } - override fun visitFunction(declaration: IrFunction): IrStatement = super.visitFunction( + override fun visitSimpleFunction(declaration: IrSimpleFunction): IrStatement = super.visitFunction( if (declaration.origin == IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER && declaration.dispatchReceiverParameter != null) context.getStaticFunctionWithReceivers(declaration).also { it.body = declaration.moveBodyTo(it) @@ -106,7 +103,7 @@ private class StaticDefaultCallLowering( } } -private fun JvmBackendContext.getStaticFunctionWithReceivers(function: IrFunction) = +private fun JvmBackendContext.getStaticFunctionWithReceivers(function: IrSimpleFunction) = staticDefaultStubs.getOrPut(function.symbol) { irFactory.createStaticFunctionWithReceivers(function.parent, function.name, function) } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt index 934d94c6185..5ff1b7cc1dd 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt @@ -313,7 +313,7 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle } } - private fun createSimpleFunctionCall(accessor: IrFunction, targetSymbol: IrFunctionSymbol, superQualifierSymbol: IrClassSymbol?) = + private fun createSimpleFunctionCall(accessor: IrFunction, targetSymbol: IrSimpleFunctionSymbol, superQualifierSymbol: IrClassSymbol?) = IrCallImpl( UNDEFINED_OFFSET, UNDEFINED_OFFSET, accessor.returnType, @@ -410,7 +410,7 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle is IrCall -> IrCallImpl( oldExpression.startOffset, oldExpression.endOffset, oldExpression.type, - accessorSymbol, oldExpression.typeArgumentsCount, + accessorSymbol as IrSimpleFunctionSymbol, oldExpression.typeArgumentsCount, oldExpression.origin ) is IrDelegatingConstructorCall -> IrDelegatingConstructorCallImpl( @@ -447,7 +447,7 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle private fun modifyGetterExpression( oldExpression: IrGetField, - accessorSymbol: IrFunctionSymbol + accessorSymbol: IrSimpleFunctionSymbol ): IrCall { val call = IrCallImpl( oldExpression.startOffset, oldExpression.endOffset, @@ -463,7 +463,7 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle private fun modifySetterExpression( oldExpression: IrSetField, - accessorSymbol: IrFunctionSymbol + accessorSymbol: IrSimpleFunctionSymbol ): IrCall { val call = IrCallImpl( oldExpression.startOffset, oldExpression.endOffset, diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AssignmentGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AssignmentGenerator.kt index ee952ac3c5e..fa7f1e62144 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AssignmentGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AssignmentGenerator.kt @@ -28,7 +28,6 @@ import org.jetbrains.kotlin.ir.builders.irGet import org.jetbrains.kotlin.ir.builders.irTemporary import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.IrDynamicOperatorExpressionImpl -import org.jetbrains.kotlin.ir.util.referenceFunction import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.endOffset @@ -317,8 +316,8 @@ class AssignmentGenerator(statementGenerator: StatementGenerator) : StatementGen val getterDescriptor = unwrappedPropertyDescriptor.unwrappedGetMethod val setterDescriptor = unwrappedPropertyDescriptor.unwrappedSetMethod - val getterSymbol = getterDescriptor?.let { context.symbolTable.referenceFunction(it.original) } - val setterSymbol = setterDescriptor?.let { context.symbolTable.referenceFunction(it.original) } + val getterSymbol = getterDescriptor?.let { context.symbolTable.referenceSimpleFunction(it.original) } + val setterSymbol = setterDescriptor?.let { context.symbolTable.referenceSimpleFunction(it.original) } val propertyIrType = descriptor.type.toIrType() return if (getterSymbol != null || setterSymbol != null) { diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/CallGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/CallGenerator.kt index 66391cbe59b..f1897139269 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/CallGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/CallGenerator.kt @@ -23,7 +23,6 @@ import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.types.IrDynamicType import org.jetbrains.kotlin.ir.types.IrType -import org.jetbrains.kotlin.ir.util.referenceFunction import org.jetbrains.kotlin.ir.util.render import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.psiUtil.endOffset @@ -122,7 +121,7 @@ class CallGenerator(statementGenerator: StatementGenerator) : StatementGenerator ) = if (descriptor is LocalVariableDescriptor && descriptor.isDelegated) { val getterDescriptor = descriptor.getter!! - val getterSymbol = context.symbolTable.referenceFunction(getterDescriptor.original) + val getterSymbol = context.symbolTable.referenceSimpleFunction(getterDescriptor.original) IrCallImpl( startOffset, endOffset, descriptor.type.toIrType(), getterSymbol, origin ?: IrStatementOrigin.GET_LOCAL_PROPERTY ).apply { @@ -207,7 +206,7 @@ class CallGenerator(statementGenerator: StatementGenerator) : StatementGenerator dispatchReceiver ) } else { - val getterSymbol = context.symbolTable.referenceFunction(getMethodDescriptor.original) + val getterSymbol = context.symbolTable.referenceSimpleFunction(getMethodDescriptor.original) IrCallImpl( startOffset, endOffset, irType, @@ -333,7 +332,7 @@ class CallGenerator(statementGenerator: StatementGenerator) : StatementGenerator ) } } else { - val originalSymbol = context.symbolTable.referenceFunction(functionDescriptor.original) + val originalSymbol = context.symbolTable.referenceSimpleFunction(functionDescriptor.original) IrCallImpl( startOffset, endOffset, irType, diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt index fc6a3546e0c..d532b839029 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt @@ -32,7 +32,6 @@ import org.jetbrains.kotlin.ir.expressions.typeParametersCount import org.jetbrains.kotlin.ir.util.createIrClassFromDescriptor import org.jetbrains.kotlin.ir.util.declareSimpleFunctionWithOverrides import org.jetbrains.kotlin.ir.util.properties -import org.jetbrains.kotlin.ir.util.referenceFunction import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtDelegatedSuperTypeEntry import org.jetbrains.kotlin.psi.KtEnumEntry @@ -332,7 +331,7 @@ class ClassGenerator( val substitutedDelegateTo = substituteDelegateToDescriptor(delegatedDescriptor, delegateToDescriptor) val returnType = substitutedDelegateTo.returnType!! - val delegateToSymbol = context.symbolTable.referenceFunction(delegateToDescriptor.original) + val delegateToSymbol = context.symbolTable.referenceSimpleFunction(delegateToDescriptor.original) val irCall = IrCallImpl( startOffset, endOffset, diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/OperatorExpressionGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/OperatorExpressionGenerator.kt index 74e931dde81..284ee3a6280 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/OperatorExpressionGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/OperatorExpressionGenerator.kt @@ -29,7 +29,6 @@ import org.jetbrains.kotlin.ir.types.classifierOrFail import org.jetbrains.kotlin.ir.types.classifierOrNull import org.jetbrains.kotlin.ir.types.impl.originalKotlinType import org.jetbrains.kotlin.ir.types.makeNotNull -import org.jetbrains.kotlin.ir.util.referenceFunction import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.* @@ -413,7 +412,7 @@ class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : Stat functionDescriptor: FunctionDescriptor, receiver: IrExpression ): IrExpression { - val originalSymbol = context.symbolTable.referenceFunction(functionDescriptor.original) + val originalSymbol = context.symbolTable.referenceSimpleFunction(functionDescriptor.original) return IrCallImpl( startOffset, endOffset, diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt index 8fd850f9875..2f5cf512f99 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt @@ -32,6 +32,7 @@ import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.name.Name @@ -197,18 +198,13 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St val irType = resolvedDescriptor.returnType!!.toIrType() - val irCall = - if (resolvedDescriptor is ConstructorDescriptor) - IrConstructorCallImpl.fromSymbolDescriptor( - startOffset, endOffset, irType, - adapteeSymbol as IrConstructorSymbol - ) - else - IrCallImpl( - startOffset, endOffset, irType, - adapteeSymbol, - origin = null, superQualifierSymbol = null - ) + val irCall = when (adapteeSymbol) { + is IrConstructorSymbol -> + IrConstructorCallImpl.fromSymbolDescriptor(startOffset, endOffset, irType, adapteeSymbol) + is IrSimpleFunctionSymbol -> + IrCallImpl(startOffset, endOffset, irType, adapteeSymbol, origin = null, superQualifierSymbol = null) + else -> error("Unknown symbol kind $adapteeSymbol") + } val hasBoundDispatchReceiver = resolvedCall.dispatchReceiver != null && resolvedCall.dispatchReceiver !is TransientReceiver val hasBoundExtensionReceiver = resolvedCall.extensionReceiver != null && resolvedCall.extensionReceiver !is TransientReceiver diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/PropertyLValue.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/PropertyLValue.kt index 818e1d34791..983bc792550 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/PropertyLValue.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/PropertyLValue.kt @@ -25,7 +25,7 @@ import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol -import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.psi2ir.generators.GeneratorContext @@ -126,9 +126,9 @@ class AccessorPropertyLValue( endOffset: Int, origin: IrStatementOrigin?, type: IrType, - val getter: IrFunctionSymbol?, + val getter: IrSimpleFunctionSymbol?, val getterDescriptor: FunctionDescriptor?, - val setter: IrFunctionSymbol?, + val setter: IrSimpleFunctionSymbol?, val setterDescriptor: FunctionDescriptor?, val typeArguments: List?, callReceiver: CallReceiver, diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrCall.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrCall.kt index 73f2b18f043..e1c45dabf72 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrCall.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrCall.kt @@ -17,10 +17,12 @@ package org.jetbrains.kotlin.ir.expressions import org.jetbrains.kotlin.ir.symbols.IrClassSymbol +import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol abstract class IrCall( typeArgumentsCount: Int, valueArgumentsCount: Int, ) : IrFunctionAccessExpression(typeArgumentsCount, valueArgumentsCount) { + override abstract val symbol: IrSimpleFunctionSymbol abstract val superQualifierSymbol: IrClassSymbol? } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallImpl.kt index a245d3c28fc..b7fe16e2846 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCallImpl.kt @@ -22,7 +22,7 @@ import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.expressions.typeParametersCount import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol -import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.util.render import org.jetbrains.kotlin.ir.visitors.IrElementVisitor @@ -31,7 +31,7 @@ class IrCallImpl( override val startOffset: Int, override val endOffset: Int, override val type: IrType, - override val symbol: IrFunctionSymbol, + override val symbol: IrSimpleFunctionSymbol, typeArgumentsCount: Int, valueArgumentsCount: Int, override val origin: IrStatementOrigin? = null, @@ -48,7 +48,7 @@ class IrCallImpl( startOffset: Int, endOffset: Int, type: IrType, - symbol: IrFunctionSymbol, + symbol: IrSimpleFunctionSymbol, origin: IrStatementOrigin? = null, superQualifierSymbol: IrClassSymbol? = null ) : this( @@ -61,7 +61,7 @@ class IrCallImpl( startOffset: Int, endOffset: Int, type: IrType, - symbol: IrFunctionSymbol, + symbol: IrSimpleFunctionSymbol, typeArgumentsCount: Int, origin: IrStatementOrigin? = null, superQualifierSymbol: IrClassSymbol? = null diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt index c3dee986f00..7a0f34bae85 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTreeWithSymbols.kt @@ -519,7 +519,7 @@ open class DeepCopyIrTreeWithSymbols( } private fun shallowCopyCall(expression: IrCall): IrCall { - val newCallee = symbolRemapper.getReferencedFunction(expression.symbol) + val newCallee = symbolRemapper.getReferencedSimpleFunction(expression.symbol) return IrCallImpl( expression.startOffset, expression.endOffset, expression.type.remapType(), diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrUtils.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrUtils.kt index 8fb65e47496..2f5cdabc4cb 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrUtils.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrUtils.kt @@ -411,7 +411,7 @@ fun irConstructorCall( fun irCall( call: IrFunctionAccessExpression, - newFunction: IrFunction, + newFunction: IrSimpleFunction, receiversAsArguments: Boolean = false, argumentsAsReceivers: Boolean = false, newSuperQualifierSymbol: IrClassSymbol? = null @@ -426,7 +426,7 @@ fun irCall( fun irCall( call: IrFunctionAccessExpression, - newSymbol: IrFunctionSymbol, + newSymbol: IrSimpleFunctionSymbol, receiversAsArguments: Boolean = false, argumentsAsReceivers: Boolean = false, newSuperQualifierSymbol: IrClassSymbol? = null diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileDeserializer.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileDeserializer.kt index c29ef995e4c..d11ab6ae8fb 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileDeserializer.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileDeserializer.kt @@ -379,7 +379,7 @@ abstract class IrFileDeserializer( } private fun deserializeCall(proto: ProtoCall, start: Int, end: Int, type: IrType): IrCall { - val symbol = deserializeIrSymbolAndRemap(proto.symbol) as IrFunctionSymbol + val symbol = deserializeIrSymbolAndRemap(proto.symbol) as IrSimpleFunctionSymbol val superSymbol = if (proto.hasSuper()) { deserializeIrSymbolAndRemap(proto.`super`) as IrClassSymbol diff --git a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ir/ParcelableIrTransformer.kt b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ir/ParcelableIrTransformer.kt index 1e57a25bcd2..bbce17eb1d3 100644 --- a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ir/ParcelableIrTransformer.kt +++ b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ir/ParcelableIrTransformer.kt @@ -28,7 +28,6 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrFunctionReference import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl import org.jetbrains.kotlin.ir.expressions.impl.IrFunctionReferenceImpl -import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrSymbol import org.jetbrains.kotlin.ir.types.* @@ -51,7 +50,7 @@ class ParcelableIrTransformer(private val context: IrPluginContext, private val private fun IrPluginContext.createIrBuilder(symbol: IrSymbol) = DeclarationIrBuilder(this, symbol, symbol.owner.startOffset, symbol.owner.endOffset) - private val symbolMap = mutableMapOf() + private val symbolMap = mutableMapOf() private val irFactory: IrFactory = IrFactoryImpl @@ -91,7 +90,7 @@ class ParcelableIrTransformer(private val context: IrPluginContext, private val override fun visitSimpleFunction(declaration: IrSimpleFunction): IrStatement { // Remap overridden symbols, otherwise the code might break in BridgeLowering declaration.overriddenSymbols = declaration.overriddenSymbols.map { symbol -> - (symbolMap[symbol] ?: symbol) as IrSimpleFunctionSymbol + symbolMap[symbol] ?: symbol } return super.visitSimpleFunction(declaration) }