Android extensions: do not produce unbound symbol for mutableMapOf

#KT-50784 Fixed
This commit is contained in:
Alexander Udalov
2022-02-03 00:46:03 +01:00
committed by Alexander Udalov
parent a2167200d6
commit 210cc67041
@@ -27,7 +27,10 @@ import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.*
import org.jetbrains.kotlin.ir.expressions.impl.IrBlockImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrGetFieldImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
@@ -117,8 +120,8 @@ private class AndroidIrTransformer(val extension: AndroidIrExtension, val plugin
}
// NOTE: sparse array version intentionally not implemented; this plugin is deprecated
private val mapFactory = pluginContext.irBuiltIns.findFunctions(Name.identifier("mutableMapOf"), "kotlin", "collections")
.single { it.descriptor.valueParameters.isEmpty() } // unbound - can't use `owner`
private val mapFactory = pluginContext.referenceFunctions(FqName("kotlin.collections.mutableMapOf"))
.single { it.owner.valueParameters.isEmpty() }
private val mapGet = pluginContext.irBuiltIns.mapClass.owner.functions
.single { it.name.asString() == "get" && it.valueParameters.size == 1 }
private val mapSet = pluginContext.irBuiltIns.mutableMapClass.owner.functions