Replace map { ... }.filterNotNull() with mapNotNull { ... }

This commit is contained in:
Ilya Gorbunov
2015-11-13 23:43:05 +03:00
parent 5b02a59cb7
commit 32151c077e
112 changed files with 197 additions and 269 deletions
@@ -85,7 +85,7 @@ public fun <TCallable : CallableDescriptor> TCallable.substituteExtensionIfCalla
val extensionReceiverType = fuzzyExtensionReceiverType()!!
val substitutors = types
.map {
.mapNotNull {
var substitutor = extensionReceiverType.checkIsSuperTypeOf(it)
// check if we may fail due to receiver expression being nullable
if (substitutor == null && it.nullability() == TypeNullability.NULLABLE && extensionReceiverType.nullability() == TypeNullability.NOT_NULL) {
@@ -93,7 +93,6 @@ public fun <TCallable : CallableDescriptor> TCallable.substituteExtensionIfCalla
}
substitutor
}
.filterNotNull()
if (getTypeParameters().isEmpty()) { // optimization for non-generic callables
return if (substitutors.any()) listOf(this) else listOf()
}
@@ -282,7 +282,7 @@ class PartialBodyResolveFilter(
else {
val leftName = left.smartCastExpressionName()
val rightName = right.smartCastExpressionName()
val names = listOf(leftName, rightName).filterNotNull().toSet()
val names = listOfNotNull(leftName, rightName).toSet()
return Pair(names, setOf())
}
}