// checkQuestionForRedeclarationWithDifferentTypes checks if the passed question has been declared before with a different type, and if so, adds an error to the typechecker
func checkQuestionForRedeclarationWithDifferentTypes(question interfaces.Question, typeCheckArgs interfaces.TypeCheckArgs) {
	varDecl := question.VarDecl()
	varID := varDecl.VariableIdentifier()

	if typeCheckArgs.Symbols().IsTypeSetForVarID(varID) && typeCheckArgs.Symbols().TypeForVarID(varID) != varDecl.ValueType() {
		typeCheckArgs.TypeChecker().AddEncounteredError(errors.NewQuestionRedeclaredWithDifferentTypesError(varDecl.ValueType(), typeCheckArgs.Symbols().TypeForVarID(varID)))
	}
}
// checkQuestionForDuplicateLabels checks if there are multiple questions with the same label, and if so, adds an warning to the typechecker
func checkQuestionForDuplicateLabels(question interfaces.Question, typeChecker interfaces.TypeChecker) {
	labelKnown := typeChecker.IsLabelUsed(question.Label())

	if labelKnown {
		typeChecker.AddEncounteredWarning(errors.NewDuplicateLabelWarning(question, typeChecker.VarIDForLabel(question.Label())))
		return
	}

	typeChecker.MarkLabelAsUsed(question.Label(), question.VarDecl())
}
// checkForCyclicDependencies checks if the this question depends on itself, and if so, adds an error to the typechecker
func checkForCyclicDependencies(question interfaces.Question, typeChecker interfaces.TypeChecker) {
	// if we find our own VarID as a dependency at least once, the dependencyChain is cyclic
	if typeChecker.DependencyListForVarDeclContainsReferenceToSelf(question.VarDecl()) {
		typeChecker.AddEncounteredError(errors.NewCyclicDependencyError(question.VarDecl()))
	}
}