From 7fa13f758f5552b093e4b803286e5323c0b841e5 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Wed, 17 Nov 2021 18:38:54 +0300 Subject: [PATCH] Make constraint system fail hard on registering existing variable --- .../resolve/calls/inference/model/NewConstraintSystemImpl.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt index 94b4c10bf27..d6ea7cae4a9 100644 --- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt +++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt @@ -115,7 +115,8 @@ class NewConstraintSystemImpl( checkState(State.BUILDING, State.COMPLETION, State.TRANSACTION) transactionRegisterVariable(variable) - storage.allTypeVariables[variable.freshTypeConstructor()] = variable + storage.allTypeVariables.put(variable.freshTypeConstructor(), variable) + ?.let { error("Type variable already registered: old: $it, new: $variable") } notProperTypesCache.clear() storage.notFixedTypeVariables[variable.freshTypeConstructor()] = MutableVariableWithConstraints(this, variable) }