[FE 1.0] Return to the old type intersection emptiness check

This reverts commit 8227c4b603.
#KT-53656 Fixed
This commit is contained in:
Mikhail Glukhikh
2022-09-06 11:46:47 +02:00
committed by Space
parent 5c09d7838d
commit 3bdd52b64a
15 changed files with 24 additions and 89 deletions
@@ -48,6 +48,8 @@ interface KotlinResolutionStatelessCallbacks {
fun isBuilderInferenceCall(argument: KotlinCallArgument, parameter: ValueParameterDescriptor): Boolean
fun isApplicableCallForBuilderInference(descriptor: CallableDescriptor, languageVersionSettings: LanguageVersionSettings): Boolean
fun isOldIntersectionIsEmpty(types: Collection<KotlinType>): Boolean
fun createConstraintSystemForOverloadResolution(
constraintInjector: ConstraintInjector, builtIns: KotlinBuiltIns
): SimpleConstraintSystem
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.types.error.ErrorUtils
import org.jetbrains.kotlin.types.model.*
import org.jetbrains.kotlin.types.typeUtil.*
import org.jetbrains.kotlin.utils.SmartList
import org.jetbrains.kotlin.utils.addToStdlib.cast
import org.jetbrains.kotlin.utils.addToStdlib.compactIfPossible
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
@@ -900,8 +901,8 @@ internal object CheckIncompatibleTypeVariableUpperBounds : ResolutionPart() {
* Check if the candidate was already discriminated by `CompatibilityOfTypeVariableAsIntersectionTypePart` resolution part
* If it's true we shouldn't mark the candidate with warning, but should mark with error, to repeat the existing proper behaviour
*/
private fun wasPreviouslyDiscriminated(upperTypes: List<KotlinTypeMarker>) =
isEmptyIntersectionTypeCompatible(*upperTypes.toTypedArray())
private fun ResolutionCandidate.wasPreviouslyDiscriminated(upperTypes: List<KotlinTypeMarker>) =
callComponents.statelessCallbacks.isOldIntersectionIsEmpty(upperTypes.cast())
override fun ResolutionCandidate.process(workIndex: Int) = with(getSystem().asConstraintSystemCompleterContext()) {
val constraintSystem = getSystem()