[FE 1.0] Get rid of absolute CompatibilityOfTypeVariableAsIntersectionTypePart
This commit is contained in:
committed by
teamcity
parent
47d6236a2d
commit
c71ae4301c
-19
@@ -304,25 +304,6 @@ internal object PostponedVariablesInitializerResolutionPart : ResolutionPart() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal object CompatibilityOfTypeVariableAsIntersectionTypePart : ResolutionPart() {
|
|
||||||
override fun ResolutionCandidate.process(workIndex: Int) {
|
|
||||||
val csBuilder = getSystem().getBuilder()
|
|
||||||
for ((_, variableWithConstraints) in csBuilder.currentStorage().notFixedTypeVariables) {
|
|
||||||
val constraints = variableWithConstraints.constraints.filter { csBuilder.isProperType(it.type) }
|
|
||||||
|
|
||||||
if (constraints.size <= 1) continue
|
|
||||||
if (constraints.any { it.kind.isLower() || it.kind.isEqual() }) continue
|
|
||||||
|
|
||||||
// See TypeBoundsImpl.computeValues(). It returns several values for such situation which means an error in OI
|
|
||||||
if (callComponents.statelessCallbacks.isOldIntersectionIsEmpty(constraints.map { it.type }.cast())) {
|
|
||||||
markCandidateForCompatibilityResolve()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal object CompatibilityOfPartiallyApplicableSamConversion : ResolutionPart() {
|
internal object CompatibilityOfPartiallyApplicableSamConversion : ResolutionPart() {
|
||||||
override fun ResolutionCandidate.process(workIndex: Int) {
|
override fun ResolutionCandidate.process(workIndex: Int) {
|
||||||
if (resolvedCall.argumentsWithConversion.isEmpty()) return
|
if (resolvedCall.argumentsWithConversion.isEmpty()) return
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import org.jetbrains.kotlin.resolve.calls.components.CheckSuperExpressionCallPar
|
|||||||
import org.jetbrains.kotlin.resolve.calls.components.CheckVisibility
|
import org.jetbrains.kotlin.resolve.calls.components.CheckVisibility
|
||||||
import org.jetbrains.kotlin.resolve.calls.components.CollectionTypeVariableUsagesInfo
|
import org.jetbrains.kotlin.resolve.calls.components.CollectionTypeVariableUsagesInfo
|
||||||
import org.jetbrains.kotlin.resolve.calls.components.CompatibilityOfPartiallyApplicableSamConversion
|
import org.jetbrains.kotlin.resolve.calls.components.CompatibilityOfPartiallyApplicableSamConversion
|
||||||
import org.jetbrains.kotlin.resolve.calls.components.CompatibilityOfTypeVariableAsIntersectionTypePart
|
|
||||||
import org.jetbrains.kotlin.resolve.calls.components.CreateFreshVariablesSubstitutor
|
import org.jetbrains.kotlin.resolve.calls.components.CreateFreshVariablesSubstitutor
|
||||||
import org.jetbrains.kotlin.resolve.calls.components.EagerResolveOfCallableReferences
|
import org.jetbrains.kotlin.resolve.calls.components.EagerResolveOfCallableReferences
|
||||||
import org.jetbrains.kotlin.resolve.calls.components.MapArguments
|
import org.jetbrains.kotlin.resolve.calls.components.MapArguments
|
||||||
@@ -57,7 +56,6 @@ enum class KotlinCallKind(vararg resolutionPart: ResolutionPart) {
|
|||||||
CheckArgumentsInParenthesis,
|
CheckArgumentsInParenthesis,
|
||||||
CheckExternalArgument,
|
CheckExternalArgument,
|
||||||
EagerResolveOfCallableReferences,
|
EagerResolveOfCallableReferences,
|
||||||
CompatibilityOfTypeVariableAsIntersectionTypePart,
|
|
||||||
CompatibilityOfPartiallyApplicableSamConversion,
|
CompatibilityOfPartiallyApplicableSamConversion,
|
||||||
PostponedVariablesInitializerResolutionPart,
|
PostponedVariablesInitializerResolutionPart,
|
||||||
CheckContextReceiversResolutionPart,
|
CheckContextReceiversResolutionPart,
|
||||||
@@ -72,7 +70,6 @@ enum class KotlinCallKind(vararg resolutionPart: ResolutionPart) {
|
|||||||
CollectionTypeVariableUsagesInfo,
|
CollectionTypeVariableUsagesInfo,
|
||||||
CheckReceivers,
|
CheckReceivers,
|
||||||
CheckCallableReference,
|
CheckCallableReference,
|
||||||
CompatibilityOfTypeVariableAsIntersectionTypePart,
|
|
||||||
CheckIncompatibleTypeVariableUpperBounds
|
CheckIncompatibleTypeVariableUpperBounds
|
||||||
),
|
),
|
||||||
UNSUPPORTED();
|
UNSUPPORTED();
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ object Scope {
|
|||||||
fun <T : Comparable<T>, S : T> greater(x: Bar<in S>, t: T) {}
|
fun <T : Comparable<T>, S : T> greater(x: Bar<in S>, t: T) {}
|
||||||
|
|
||||||
fun test(b: Bar<Long>) {
|
fun test(b: Bar<Long>) {
|
||||||
<!DEBUG_INFO_CALL("fqName: Scope.greater; typeCall: function")!><!COMPATIBILITY_WARNING!>greater<!>(b, b)<!>
|
<!DEBUG_INFO_CALL("fqName: Scope.greater; typeCall: function")!>greater(b, b)<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user