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:
Denis Zharkov
2017-10-05 11:12:02 +03:00
parent 1c9b454d90
commit 6e59799b54
2 changed files with 2 additions and 8 deletions
@@ -81,7 +81,7 @@ fun replaceReturnTypeForCallable(type: KotlinType, given: KotlinType): KotlinTyp
fun replaceReturnTypeByUnknown(type: KotlinType) = replaceReturnTypeForCallable(type, DONT_CARE)
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) =
type.arguments.dropLast(1)
@@ -135,13 +135,7 @@ fun SimpleType.replace(
if (newArguments.isEmpty() && newAnnotations === annotations) return this
if (newArguments.isEmpty()) {
return KotlinTypeFactory.simpleTypeWithNonTrivialMemberScope(
newAnnotations,
constructor,
arguments,
isMarkedNullable,
memberScope
)
return replaceAnnotations(newAnnotations)
}
return KotlinTypeFactory.simpleType(