JVM IR: get rid of toIrBasedKotlinType in MethodSignatureMapper
Commonize (in terms of TypeSystemCommonBackendContext implementations for KotlinType/IrType) code that computes optimal TypeMappingMode to apply to different positions where inline class types can be present.
This commit is contained in:
@@ -218,7 +218,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
return mapType(returnType, sw, typeMappingModeFromAnnotation)
|
||||
}
|
||||
|
||||
val mappingMode = TypeMappingMode.getOptimalModeForReturnType(returnType, isAnnotationMethod)
|
||||
val mappingMode = typeSystem.getOptimalModeForReturnType(returnType, isAnnotationMethod)
|
||||
|
||||
return mapType(returnType, sw, mappingMode)
|
||||
}
|
||||
@@ -1084,7 +1084,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
?: if (callableDescriptor.isMethodWithDeclarationSiteWildcards && type.arguments.isNotEmpty()) {
|
||||
TypeMappingMode.GENERIC_ARGUMENT // Render all wildcards
|
||||
} else {
|
||||
TypeMappingMode.getOptimalModeForValueParameter(type)
|
||||
typeSystem.getOptimalModeForValueParameter(type)
|
||||
}
|
||||
|
||||
mapType(type, sw, typeMappingMode)
|
||||
|
||||
+2
-3
@@ -33,7 +33,6 @@ import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyFunction
|
||||
import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyFunctionBase
|
||||
import org.jetbrains.kotlin.ir.descriptors.IrBasedSimpleFunctionDescriptor
|
||||
import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor
|
||||
import org.jetbrains.kotlin.ir.descriptors.toIrBasedKotlinType
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.types.*
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
@@ -190,7 +189,7 @@ class MethodSignatureMapper(private val context: JvmBackendContext) {
|
||||
return typeMapper.mapType(returnType, typeMappingModeFromAnnotation, sw)
|
||||
}
|
||||
|
||||
val mappingMode = TypeMappingMode.getOptimalModeForReturnType(returnType.toIrBasedKotlinType(), isAnnotationMethod)
|
||||
val mappingMode = typeSystem.getOptimalModeForReturnType(returnType, isAnnotationMethod)
|
||||
|
||||
return typeMapper.mapType(returnType, mappingMode, sw)
|
||||
}
|
||||
@@ -358,7 +357,7 @@ class MethodSignatureMapper(private val context: JvmBackendContext) {
|
||||
?: if (declaration.isMethodWithDeclarationSiteWildcards && type.argumentsCount() != 0) {
|
||||
TypeMappingMode.GENERIC_ARGUMENT // Render all wildcards
|
||||
} else {
|
||||
TypeMappingMode.getOptimalModeForValueParameter(type.toIrBasedKotlinType())
|
||||
typeSystem.getOptimalModeForValueParameter(type)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -1,7 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: BINDING_RECEIVERS
|
||||
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// KT-42025
|
||||
|
||||
open class L<LL>(val ll: LL)
|
||||
@@ -98,4 +96,4 @@ fun box(): String {
|
||||
val ipl = i.readP(Rec("OK"))
|
||||
|
||||
return ipl.ll
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -1,7 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: BINDING_RECEIVERS
|
||||
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// KT-42025
|
||||
|
||||
open class L<LL>(val ll: LL)
|
||||
@@ -22,4 +20,4 @@ val <PT> Rec<PT>.p: L<PT>
|
||||
fun <T1, T2, R> foo2(t1: T1, t2: T2, bb: (T1, T2) -> R): R = bb(t1, t2)
|
||||
|
||||
fun box(): String =
|
||||
Rec("O").fn().ll + Rec("K").p.ll
|
||||
Rec("O").fn().ll + Rec("K").p.ll
|
||||
|
||||
Reference in New Issue
Block a user