SkipLabs/skip

[skargo] Syntax errors produce misleading error messages

Closed this issue · 1 comments

When the compiler frontend produces errors, skargo build is warning of "No such file or directory" instead of reporting the skc error messages.

e.g. if I introduce a syntax error

diff --git a/sql/src/Main.sk b/sql/src/Main.sk
index e87e010c..77ef4d71 100644
--- a/sql/src/Main.sk
+++ b/sql/src/Main.sk
@@ -763,3 +763,4 @@ fun execToggleView(args: Cli.ParseResults, _options: SKDB.Options): void {
 }
 
 module end;
+syntax error

and run skc --check sql/src/Main.sk then I get the expected

File "sql/src/Main.sk", line 766, characters 1-6:
Expected declaration.
764 |
765 | module end;
766 | syntax error
    | ^^^^^^

but if I run (cd sql && skargo build --release) then I get the following

    Fresh std v0.1.0 [build-script-std] (/skdb/prelude)
    Fresh std v0.1.0 [lib] (/skdb/prelude)
    Fresh skbuild v0.1.0 [lib] (/skdb/skbuild)
    Fresh skdate v0.1.0 [build-script-skdate] (/skdb/skdate)
    Fresh skdate v0.1.0 [lib] (/skdb/skdate)
    Fresh cli v0.1.0 [lib] (/skdb/cli)
    Fresh skjson v0.1.0 [lib] (/skdb/skjson)
    Fresh sqlparser v0.1.0 [lib] (/skdb/sqlparser)
    Compiling skdb v0.1.0 [lib] (/skdb/sql)
error command exited with non-zero status

Caused by:
  process did not exit successfully: `skc` (exit status: 45)
  --- stdout

  --- stderr
  ERROR (open failed): No such file or directory
  Could not open file: skdb:/skdb/sql/src/Main.sk

Can of course be worked around by running skc --check when needed, but curious if others are seeing the same behaviour.

I confirm, and I have a fix.