Get rid of a couple of usages of simpleTypeWithNonTrivialMemberScope
The simple versions of KotlinTypeFactory::simpleType may lead to smaller number of KotlinType instances (defaultType from descriptor are used if there are no arguments)
This commit is contained in:
@@ -81,7 +81,7 @@ fun replaceReturnTypeForCallable(type: KotlinType, given: KotlinType): KotlinTyp
|
|||||||
fun replaceReturnTypeByUnknown(type: KotlinType) = replaceReturnTypeForCallable(type, DONT_CARE)
|
fun replaceReturnTypeByUnknown(type: KotlinType) = replaceReturnTypeForCallable(type, DONT_CARE)
|
||||||
|
|
||||||
private fun replaceTypeArguments(type: KotlinType, newArguments: List<TypeProjection>) =
|
private fun replaceTypeArguments(type: KotlinType, newArguments: List<TypeProjection>) =
|
||||||
KotlinTypeFactory.simpleTypeWithNonTrivialMemberScope(type.annotations, type.constructor, newArguments, type.isMarkedNullable, type.memberScope)
|
KotlinTypeFactory.simpleType(type.annotations, type.constructor, newArguments, type.isMarkedNullable)
|
||||||
|
|
||||||
private fun getParameterArgumentsOfCallableType(type: KotlinType) =
|
private fun getParameterArgumentsOfCallableType(type: KotlinType) =
|
||||||
type.arguments.dropLast(1)
|
type.arguments.dropLast(1)
|
||||||
|
|||||||
@@ -135,13 +135,7 @@ fun SimpleType.replace(
|
|||||||
if (newArguments.isEmpty() && newAnnotations === annotations) return this
|
if (newArguments.isEmpty() && newAnnotations === annotations) return this
|
||||||
|
|
||||||
if (newArguments.isEmpty()) {
|
if (newArguments.isEmpty()) {
|
||||||
return KotlinTypeFactory.simpleTypeWithNonTrivialMemberScope(
|
return replaceAnnotations(newAnnotations)
|
||||||
newAnnotations,
|
|
||||||
constructor,
|
|
||||||
arguments,
|
|
||||||
isMarkedNullable,
|
|
||||||
memberScope
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return KotlinTypeFactory.simpleType(
|
return KotlinTypeFactory.simpleType(
|
||||||
|
|||||||
Reference in New Issue
Block a user