Make constraint system fail hard on registering existing variable

This commit is contained in:
Simon Ogorodnik
2021-11-17 18:38:54 +03:00
committed by Space
parent ae2c4753df
commit 7fa13f758f
@@ -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)
}