More cleanup: lift return / assignment out
This commit is contained in:
@@ -79,10 +79,10 @@ private fun chooseMoreSpecific(type1: KotlinType, type2: KotlinType): KotlinType
|
||||
else -> { // type1IsSubtype && type2IsSubtype
|
||||
val flexible1 = type1.unwrap() as? FlexibleType
|
||||
val flexible2 = type2.unwrap() as? FlexibleType
|
||||
when {
|
||||
flexible1 != null && flexible2 == null -> return type2
|
||||
flexible2 != null && flexible1 == null -> return type1
|
||||
else -> return null //TODO?
|
||||
return when {
|
||||
flexible1 != null && flexible2 == null -> type2
|
||||
flexible2 != null && flexible1 == null -> type1
|
||||
else -> null //TODO?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ fun <TCallable : CallableDescriptor> TCallable.substituteExtensionIfCallable(
|
||||
containingDeclarationOrModule: DeclarationDescriptor
|
||||
): Collection<TCallable> {
|
||||
val sequence = receivers.asSequence().flatMap { substituteExtensionIfCallable(it, callType, context, dataFlowInfo, containingDeclarationOrModule).asSequence() }
|
||||
if (typeParameters.isEmpty()) { // optimization for non-generic callables
|
||||
return sequence.firstOrNull()?.let { listOf(it) } ?: listOf()
|
||||
return if (typeParameters.isEmpty()) { // optimization for non-generic callables
|
||||
sequence.firstOrNull()?.let { listOf(it) } ?: listOf()
|
||||
}
|
||||
else {
|
||||
return sequence.toList()
|
||||
sequence.toList()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,11 +91,11 @@ fun <TCallable : CallableDescriptor> TCallable.substituteExtensionIfCallable(
|
||||
}
|
||||
substitutor
|
||||
}
|
||||
if (typeParameters.isEmpty()) { // optimization for non-generic callables
|
||||
return if (substitutors.any()) listOf(this) else listOf()
|
||||
return if (typeParameters.isEmpty()) { // optimization for non-generic callables
|
||||
if (substitutors.any()) listOf(this) else listOf()
|
||||
}
|
||||
else {
|
||||
return substitutors
|
||||
substitutors
|
||||
.mapNotNull { @Suppress("UNCHECKED_CAST") (substitute(it) as TCallable?) }
|
||||
.toList()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user