PHondogo
07/25/2024, 9:16 AMfun findMostCommonSuperTypeFor(type1: IrType, type2: IrType) : IrType {
TODO("?")
}
dmitriy.novozhilov
07/25/2024, 9:19 AMIrTypeContext
PHondogo
07/25/2024, 9:56 AMjava.lang.IllegalStateException: Should not be called
at org.jetbrains.kotlin.ir.types.IrTypeSystemContext$DefaultImpls.isError(IrTypeSystemContext.kt:388)
at org.jetbrains.kotlin.ir.types.IrTypeSystemContextImpl.isError(IrTypeSystemContext.kt:627)
at org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator.findErrorTypeInSupertypes(NewCommonSuperTypeCalculator.kt:262)
at org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator.commonSuperTypeForNotNullTypes(NewCommonSuperTypeCalculator.kt:234)
at org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator.commonSuperTypeForSimpleTypes(NewCommonSuperTypeCalculator.kt:103)
at org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator.commonSuperType(NewCommonSuperTypeCalculator.kt:62)
at org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator.commonSuperType(NewCommonSuperTypeCalculator.kt:27)
dmitriy.novozhilov
07/25/2024, 10:43 AMIrTypeSystemContext
(with delegation to IrTypeSystemContextImpl
) and override isError
(so it will always return false
)PHondogo
07/25/2024, 10:49 AMprivate val typeSystem = object : IrTypeSystemContext { // TODO temporary workaround
override val irBuiltIns: IrBuiltIns
get() = pluginContext.irBuiltIns
// if not overriden then throws 'Should not be called'
override fun TypeConstructorMarker.isError(): Boolean {
return false
}
// if not overriden with returning null then call to commonSuperType(List<KotlinTypeMarker>) return Int type for any input
override fun findCommonIntegerLiteralTypesSuperType(explicitSupertypes: List<SimpleTypeMarker>): SimpleTypeMarker? {
return null
}
}
dmitriy.novozhilov
07/25/2024, 10:50 AMval baseContext = IrTypeSystemContextImpl(irBuiltIns)
val context = object : IrTypeSystemContext by baseContext {
override fun TypeConstructorMarker.isError(): Boolean {
return false
}
}
dmitriy.novozhilov
07/25/2024, 10:50 AMPHondogo
07/25/2024, 10:52 AM