Rename KotlinTypeFactory::simpleType to simpleTypeWithNonTrivialMemberScope

To state it must be used only for limited number of cases
This commit is contained in:
Denis Zharkov
2017-10-05 11:08:53 +03:00
parent 20334a2321
commit 1c9b454d90
20 changed files with 39 additions and 39 deletions
@@ -76,11 +76,11 @@ private fun KotlinType.approximateNonDynamicFlexibleTypes(
(unwrap() as? AbbreviatedType)?.let {
return AbbreviatedType(it.expandedType, it.abbreviation.approximateNonDynamicFlexibleTypes(preferNotNull))
}
return KotlinTypeFactory.simpleType(annotations,
constructor,
arguments.map { it.substitute { type -> type.approximateFlexibleTypes(preferNotNull = true) } },
isMarkedNullable,
ErrorUtils.createErrorScope("This type is not supposed to be used in member resolution", true)
return KotlinTypeFactory.simpleTypeWithNonTrivialMemberScope(annotations,
constructor,
arguments.map { it.substitute { type -> type.approximateFlexibleTypes(preferNotNull = true) } },
isMarkedNullable,
ErrorUtils.createErrorScope("This type is not supposed to be used in member resolution", true)
)
}
@@ -155,4 +155,4 @@ fun KotlinType.getResolvableApproximations(
fun KotlinType.isAbstract(): Boolean {
val modality = (constructor.declarationDescriptor as? ClassDescriptor)?.modality
return modality == Modality.ABSTRACT || modality == Modality.SEALED
}
}
@@ -286,7 +286,7 @@ internal fun KotlinType.substitute(substitution: KotlinTypeSubstitution, varianc
val (projection, typeParameter) = pair
TypeProjectionImpl(Variance.INVARIANT, projection.type.substitute(substitution, typeParameter.variance))
}
KotlinTypeFactory.simpleType(annotations, constructor, newArguments, isMarkedNullable, memberScope)
KotlinTypeFactory.simpleTypeWithNonTrivialMemberScope(annotations, constructor, newArguments, isMarkedNullable, memberScope)
}
}
@@ -51,7 +51,7 @@ object CreateIteratorFunctionActionFactory : CreateCallableMemberFromUsageFactor
val returnJetTypeParameterType = TypeProjectionImpl(returnJetTypeParameterTypes[0])
val returnJetTypeArguments = Collections.singletonList(returnJetTypeParameterType)
val newReturnJetType = KotlinTypeFactory.simpleType(returnJetType.annotations,
val newReturnJetType = KotlinTypeFactory.simpleTypeWithNonTrivialMemberScope(returnJetType.annotations,
returnJetType.constructor,
returnJetTypeArguments,
returnJetType.isMarkedNullable,
@@ -101,7 +101,7 @@ private object ForceTypeCopySubstitution : TypeSubstitution() {
override fun get(key: KotlinType) =
with(key) {
if (isError) return@with asTypeProjection()
KotlinTypeFactory.simpleType(annotations, constructor, arguments, isMarkedNullable, memberScope).asTypeProjection()
KotlinTypeFactory.simpleTypeWithNonTrivialMemberScope(annotations, constructor, arguments, isMarkedNullable, memberScope).asTypeProjection()
}
override fun isEmpty() = false
@@ -118,4 +118,4 @@ fun suggestReceiverNames(project: Project, descriptor: CallableDescriptor): List
} ?: CollectingNameValidator(paramNames)
val receiverType = descriptor.extensionReceiverParameter?.type ?: return emptyList()
return KotlinNameSuggester.suggestNamesByType(receiverType, validator, "receiver")
}
}