Add compatibility resolve when variable has "bad" intersection type

#KT-39468 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2020-07-02 16:10:57 +03:00
parent 92a51b9794
commit d51bb2c053
13 changed files with 238 additions and 0 deletions
@@ -39,6 +39,8 @@ import org.jetbrains.kotlin.resolve.calls.model.KotlinCallArgument
import org.jetbrains.kotlin.resolve.calls.model.SimpleKotlinCallArgument
import org.jetbrains.kotlin.resolve.calls.results.SimpleConstraintSystem
import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeIntersector
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
class KotlinResolutionStatelessCallbacksImpl(
@@ -87,6 +89,10 @@ class KotlinResolutionStatelessCallbacksImpl(
return org.jetbrains.kotlin.resolve.calls.inference.isApplicableCallForBuilderInference(descriptor, languageVersionSettings)
}
override fun isOldIntersectionIsEmpty(types: Collection<KotlinType>): Boolean {
return TypeIntersector.intersectTypes(types) == null
}
override fun createConstraintSystemForOverloadResolution(
constraintInjector: ConstraintInjector, builtIns: KotlinBuiltIns,
): SimpleConstraintSystem {