[JS IR] Fix js("...") call checker in frontend.

Call mather relies on that BuiltIn package fragment implement specific
interface `BuiltInsPackageFragment` which was missed. Make sure that
BuiltIn module's package fragments implement that interface.

Fix progression optimizer symbols resolve in JS & WASM IR BE
This commit is contained in:
Roman Artemev
2021-09-27 21:52:00 +03:00
committed by TeamCityServer
parent 18950feeff
commit f05c8ad953
5 changed files with 88 additions and 14 deletions
@@ -33,10 +33,7 @@ import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.impl.DescriptorlessExternalPackageFragmentSymbol
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.IrDynamicTypeImpl
import org.jetbrains.kotlin.ir.util.SymbolTable
import org.jetbrains.kotlin.ir.util.getPropertyGetter
import org.jetbrains.kotlin.ir.util.getPropertySetter
import org.jetbrains.kotlin.ir.util.kotlinPackageFqn
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.js.config.ErrorTolerancePolicy
import org.jetbrains.kotlin.js.config.JSConfigurationKeys
import org.jetbrains.kotlin.js.config.RuntimeDiagnostic
@@ -261,6 +258,32 @@ class JsIrBackendContext(
override fun suspendFunctionN(n: Int): IrClassSymbol {
return irFactory.stageController.withInitialIr { super.suspendFunctionN(n) }
}
private val getProgressionLastElementSymbols =
irBuiltIns.findFunctions(Name.identifier("getProgressionLastElement"), "kotlin", "internal")
override val getProgressionLastElementByReturnType: Map<IrClassifierSymbol, IrSimpleFunctionSymbol> by lazy {
getProgressionLastElementSymbols.associateBy { it.owner.returnType.classifierOrFail }
}
private val toUIntSymbols = irBuiltIns.findFunctions(Name.identifier("toUInt"), "kotlin")
override val toUIntByExtensionReceiver: Map<IrClassifierSymbol, IrSimpleFunctionSymbol> by lazy {
toUIntSymbols.associateBy {
it.owner.extensionReceiverParameter?.type?.classifierOrFail
?: error("Expected extension receiver for ${it.owner.render()}")
}
}
private val toULongSymbols = irBuiltIns.findFunctions(Name.identifier("toULong"), "kotlin")
override val toULongByExtensionReceiver: Map<IrClassifierSymbol, IrSimpleFunctionSymbol> by lazy {
toULongSymbols.associateBy {
it.owner.extensionReceiverParameter?.type?.classifierOrFail
?: error("Expected extension receiver for ${it.owner.render()}")
}
}
}
override fun unfoldInlineClassType(irType: IrType): IrType? {