NI: Fix exception during callable references overload resolution

^KT-35847 Fixed
This commit is contained in:
Denis Zharkov
2020-01-15 16:10:11 +03:00
parent 588259a034
commit 676c99b933
13 changed files with 105 additions and 5 deletions
@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.types.typeUtil.asTypeProjection
import org.jetbrains.kotlin.types.typeUtil.replaceAnnotations
import org.jetbrains.kotlin.utils.DFS
import org.jetbrains.kotlin.utils.addIfNotNull
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import java.util.*
private fun KotlinType.isTypeOrSubtypeOf(predicate: (KotlinType) -> Boolean): Boolean =
@@ -140,10 +139,10 @@ fun KotlinType.getValueParameterTypesFromFunctionType(): List<TypeProjection> {
return arguments.subList(first, last)
}
fun KotlinType.getValueParameterTypesFromCallableReflectionType(withReceiver: Boolean): List<TypeProjection> {
fun KotlinType.getValueParameterTypesFromCallableReflectionType(isCallableTypeWithExtension: Boolean): List<TypeProjection> {
assert(ReflectionTypes.isKCallableType(this)) { "Not a callable reflection type: $this" }
val arguments = arguments
val first = if (withReceiver) 0 else 1
val first = if (isCallableTypeWithExtension) 1 else 0
val last = arguments.size - 1
assert(first <= last) { "Not an exact function type: $this" }
return arguments.subList(first, last)