Fix failed tests
This commit is contained in:
committed by
Dmitriy Novozhilov
parent
3c4989b672
commit
a98e2c4e03
+1
-1
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.types.model.*
|
||||
object NewCommonSuperTypeCalculator {
|
||||
fun TypeSystemCommonSuperTypesContext.commonSuperType(types: List<KotlinTypeMarker>): KotlinTypeMarker {
|
||||
val maxDepth = types.maxOfOrNull { it.typeDepth() } ?: 0
|
||||
return commonSuperType(types, -maxDepth, true).replaceTypeAttributes(unionTypeAttributes(types))
|
||||
return commonSuperType(types, -maxDepth, true).let { it.replaceTypeAttributes(unionTypeAttributes(listOf(it) + types)) }
|
||||
}
|
||||
|
||||
private fun TypeSystemCommonSuperTypesContext.commonSuperType(
|
||||
|
||||
+1
-1
@@ -411,7 +411,7 @@ class PostponedArgumentInputTypesResolver(
|
||||
argument.isFunctionExpressionWithReceiver() -> true
|
||||
else -> parameterTypesInfo.isExtensionFunction
|
||||
},
|
||||
annotations = parameterTypesInfo.annotations
|
||||
attributes = parameterTypesInfo.annotations
|
||||
)
|
||||
|
||||
getBuilder().addSubtypeConstraint(
|
||||
|
||||
+10
-6
@@ -59,14 +59,18 @@ class MutableVariableWithConstraints private constructor(
|
||||
&& previousConstraint.type == constraint.type
|
||||
&& previousConstraint.isNullabilityConstraint == constraint.isNullabilityConstraint
|
||||
) {
|
||||
val noNewCustomAttributes = with(context) {
|
||||
val previousType = previousConstraint.type
|
||||
val type = constraint.type
|
||||
(!previousType.hasCustomAttributes() && !type.hasCustomAttributes()) ||
|
||||
(previousType.getCustomAttributes() == type.getCustomAttributes())
|
||||
}
|
||||
|
||||
if (newConstraintIsUseless(previousConstraint, constraint)) {
|
||||
// Preserve constraints with different custom type attributes.
|
||||
// This allows us to union type attributes in NewCommonSuperTypeCalculator.kt
|
||||
with(context) {
|
||||
val prevAttributes = previousConstraint.type.getCustomAttributes()
|
||||
if (prevAttributes.isEmpty() || prevAttributes == constraint.type.getCustomAttributes()) {
|
||||
return previousConstraint to false
|
||||
}
|
||||
if (noNewCustomAttributes) {
|
||||
return previousConstraint to false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +79,7 @@ class MutableVariableWithConstraints private constructor(
|
||||
ConstraintKind.UPPER -> constraint.kind.isLower()
|
||||
ConstraintKind.EQUALITY -> true
|
||||
}
|
||||
if (isMatchingForSimplification) {
|
||||
if (isMatchingForSimplification && noNewCustomAttributes) {
|
||||
val actualConstraint = if (constraint.kind != ConstraintKind.EQUALITY) {
|
||||
Constraint(
|
||||
ConstraintKind.EQUALITY,
|
||||
|
||||
Reference in New Issue
Block a user