[FE] Change resolution scheme

This commit is contained in:
Anastasiya Shadrina
2021-06-17 01:10:54 +07:00
committed by TeamCityServer
parent 1f6746dc74
commit 37495bcba0
39 changed files with 455 additions and 113 deletions
@@ -87,3 +87,30 @@ private fun ConstraintSystemBuilder.addConstraintIfCompatible(
}
!hasContradiction
}
fun ConstraintSystemBuilder.isSubtypeConstraintCompatible(
lowerType: KotlinTypeMarker,
upperType: KotlinTypeMarker,
position: ConstraintPosition
): Boolean = isConstraintCompatible(lowerType, upperType, position, ConstraintKind.LOWER)
private fun ConstraintSystemBuilder.isConstraintCompatible(
lowerType: KotlinTypeMarker,
upperType: KotlinTypeMarker,
position: ConstraintPosition,
kind: ConstraintKind
): Boolean {
var isCompatible = false
runTransaction {
if (!hasContradiction) {
when (kind) {
ConstraintKind.LOWER -> addSubtypeConstraint(lowerType, upperType, position)
ConstraintKind.UPPER -> addSubtypeConstraint(upperType, lowerType, position)
ConstraintKind.EQUALITY -> addEqualityConstraint(lowerType, upperType, position)
}
}
isCompatible = !hasContradiction
false
}
return isCompatible
}