fix: fix incorrect semantic error logging by refactoring error.scala from frontend

This commit is contained in:
Jonny
2025-03-01 01:34:05 +00:00
parent 667fbf4949
commit 01b38b1445
2 changed files with 70 additions and 69 deletions

View File

@@ -53,14 +53,15 @@ def frontend(
if (errors.result.isEmpty) IO.pure(Right(typedProg))
else {
given errorContent: String = contents
val exitCode = errors.result.view.map {
case _: Error.InternalError => 201
case _ => 200
}.max
logger.error(s"Semantic errors:\n${errors.result.mkString("\n")}") *> IO.pure(
Left(exitCode)
)
val formattedErrors = errors.result.map(formatError).mkString("\n")
logger.error(s"Semantic errors:\n$formattedErrors") *> IO.pure(Left(exitCode))
}
}
}