// checkForNonBoolCondition checks if the condition is of a boolean type, and if not, adds an error to the typechecker
func checkForNonBoolCondition(condition interfaces.Expr, typeCheckArgs interfaces.TypeCheckArgs) {
	typeOfCondition := condition.TypeCheck(typeCheckArgs)

	if typeOfCondition != expr.NewBoolType() && typeOfCondition != expr.NewUnknownType() {
		typeCheckArgs.TypeChecker().AddEncounteredError(errors.NewNonBooleanConditionError(condition, typeOfCondition))
	}
}
// checkIfQuestionTypeMatchesComputationType checks if the declared computed question type and its actual type match, and if not, adds an error to the typechecker
func (this ComputedQuestion) checkIfQuestionTypeMatchesComputationType(typeCheckArgs interfaces.TypeCheckArgs) {
	actualType := this.Computation().TypeCheck(typeCheckArgs)
	expectedType := this.VarDeclValueType()

	// check if question declaration type matches the type of the computation
	if actualType != expr.NewUnknownType() && actualType != expectedType {
		typeCheckArgs.TypeChecker().AddEncounteredError(errors.NewDeclaratedTypeAndActualTypeDeviateError(expectedType, actualType))
	}
}