feat: implements error messages for DuplicateDeclaration and UndefinedIdentifier errors

This commit is contained in:
Guy C
2025-02-06 19:49:17 +00:00
parent a635370522
commit 2ac7744e68
2 changed files with 29 additions and 1 deletions

View File

@@ -38,7 +38,8 @@ def compile(contents: String): Int = {
given ctx: typeChecker.TypeCheckerCtx = typeChecker.TypeCheckerCtx(names, errors)
typeChecker.check(prog)
if (errors.result.nonEmpty) {
errors.result.foreach(println)
given errorContent: String = contents
errors.result.foreach(printError)
200
} else 0
case Failure(msg) =>