K2: Fix inference from assignment in PCLA

Before this, the order of the constraints being added was incorrect

^KT-64222 Fixed
This commit is contained in:
Denis.Zharkov
2024-01-11 11:28:52 +01:00
committed by Space Team
parent 97d17012e5
commit 8f9c09482b
6 changed files with 21 additions and 35 deletions
@@ -1035,7 +1035,8 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
// for cases like
// buildSomething { tVar = "" // Should infer TV from String assignment }
context.inferenceSession.addSubtypeConstraintIfCompatible(
variableAssignment.lValue.resolvedType, variableAssignment.rValue.resolvedType,
lowerType = variableAssignment.rValue.resolvedType,
upperType = variableAssignment.lValue.resolvedType,
variableAssignment,
)