From 6cf2c6f93a675d49c8723003b9305e5795a3b4bb Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 28 Oct 2021 13:14:53 +0300 Subject: [PATCH] Select non-DeclaredUpperBound for initial when simplifying constraint --- .../resolve/calls/inference/model/MutableConstraintStorage.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/MutableConstraintStorage.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/MutableConstraintStorage.kt index dc1a3ddc705..7ea2c276686 100644 --- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/MutableConstraintStorage.kt +++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/MutableConstraintStorage.kt @@ -73,7 +73,8 @@ class MutableVariableWithConstraints private constructor( Constraint( ConstraintKind.EQUALITY, constraint.type, - constraint.position, + constraint.position.takeIf { it.from !is DeclaredUpperBoundConstraintPosition<*> } + ?: previousConstraint.position, constraint.typeHashCode, derivedFrom = constraint.derivedFrom, isNullabilityConstraint = false