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:
Alexander Udalov
2021-03-31 19:30:30 +02:00
parent b59ac5d8f6
commit ce0c0ad2e3
7 changed files with 37 additions and 45 deletions
@@ -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)
}
}