[NI] Avoid computing few things for simple calls without type variables

This commit is contained in:
Mikhail Zarechenskiy
2019-09-17 18:47:39 +03:00
parent 7bd65c0bcd
commit 1a50a3cbb1
10 changed files with 38 additions and 10 deletions
@@ -256,7 +256,7 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext,
}
override fun typeSubstitutorByTypeConstructor(map: Map<TypeConstructorMarker, KotlinTypeMarker>): TypeSubstitutorMarker {
if (map.isEmpty()) return ConeSubstitutor.Empty
if (map.isEmpty()) return createEmptySubstitutor()
return object : AbstractConeSubstitutor(),
TypeSubstitutorMarker {
override fun substituteType(type: ConeKotlinType): ConeKotlinType? {
@@ -266,6 +266,10 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext,
}
}
override fun createEmptySubstitutor(): TypeSubstitutorMarker {
return ConeSubstitutor.Empty
}
override fun TypeSubstitutorMarker.safeSubstitute(type: KotlinTypeMarker): KotlinTypeMarker {
if (this === NoSubstitutor) return type
require(this is ConeSubstitutor)
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.fir.types.impl.FirResolvedTypeRefImpl
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.calls.components.InferenceSession
import org.jetbrains.kotlin.resolve.calls.inference.buildAbstractResultingSubstitutor
import org.jetbrains.kotlin.resolve.calls.inference.components.EmptySubstitutor
import org.jetbrains.kotlin.resolve.calls.inference.components.KotlinConstraintSystemCompleter
import org.jetbrains.kotlin.resolve.calls.inference.model.SimpleConstraintSystemConstraintPosition
import org.jetbrains.kotlin.types.model.StubTypeMarker