TypeAccessibilityCheckerImpl: explicitParameters change return type to Sequence

This commit is contained in:
Dmitry Gridin
2019-08-26 13:53:40 +07:00
parent aa135bc505
commit 35d64f85f8
@@ -105,7 +105,7 @@ private fun DeclarationDescriptor.collectAllTypes(): Sequence<FqName?> {
is CallableDescriptor -> { is CallableDescriptor -> {
val returnType = returnType ?: return sequenceOf(null) val returnType = returnType ?: return sequenceOf(null)
returnType.collectAllTypes() + returnType.collectAllTypes() +
explicitParameters.asSequence().map(ParameterDescriptor::getType).flatMap(KotlinType::collectAllTypes) + explicitParameters.map(ParameterDescriptor::getType).flatMap(KotlinType::collectAllTypes) +
typeParameters.asSequence().flatMap(DeclarationDescriptor::collectAllTypes) typeParameters.asSequence().flatMap(DeclarationDescriptor::collectAllTypes)
} }
is TypeParameterDescriptor -> { is TypeParameterDescriptor -> {
@@ -130,19 +130,9 @@ private fun KotlinType.collectAllTypes(): Sequence<FqName?> = sequenceOf(fqName)
.map(TypeProjection::getType) .map(TypeProjection::getType)
.flatMap(KotlinType::collectAllTypes) .flatMap(KotlinType::collectAllTypes)
private val CallableDescriptor.explicitParameters: List<ParameterDescriptor> private val CallableDescriptor.explicitParameters: Sequence<ParameterDescriptor>
get() { get() = valueParameters.asSequence() + dispatchReceiverParameter?.let {
val result = ArrayList<ParameterDescriptor>(valueParameters.size + 2) sequenceOf(it)
}.orEmpty() + extensionReceiverParameter?.let {
this.dispatchReceiverParameter?.let { sequenceOf(it)
result.add(it) }.orEmpty()
}
this.extensionReceiverParameter?.let {
result.add(it)
}
result.addAll(valueParameters)
return result
}