Xslt may never be able to do full self-hosted tests. Powershell succeeds
but doubles the total runtime for the GHA workflow.
We would definitely like jq, nasm, and possibly vbs to be fixed for
self-hosted tests.
Ticket tracking fixes: https://github.com/kanaka/mal/issues/662
- In ci.sh just print the path to the debug log file on errors.
- In GHA workflow, dump the debug log in a separate final step if there
were errors. This will make it more usable for tracking down errors.
In mlton mode, syntax errors caught in the try/catch block were being
processed as "SyntaxError" without any additional context/message.
Explicitly pass the full message always.
xslt:
- The reader was returning the an odd args error when a hash-map literal
was not closed. This was because the the parsing error happened and
then the odd args test happened after and overwrote the parsing error.
- Also, fix the read-string function so that if an error is set by the
reader, this is converted to a full error that bubbles up.
c:
- read_list errors were not being detected/propagated in read_hash_map
after calling read_list.
zig:
- reader errors were not being caught in the rep loop until step 8, so
those errors in step6 and step7 were causing the REPL to exit.
The mal implementation uses the defmacro! function from the host
language/environment and assumes that it returns a macro function (and
ignores the environment modification effect). The vala implementation
was setting the is_macro flag at the wrong time so that the final
returned value from defmacro! was a function without the macro flag set.
Also, add a deferrable test of `defmacro!` to make sure it returns
a macro.
Two problems were causing powershell self-hosting to fail:
* Some mal core functions are declared using `Get-Command` to hoist the
lower level function and this didn't work with the `fn?` command. So
add a stepA test for `(fn? list?)` and fix the `fn?` command to check for
CommandInfo types too.
* A list with a single `$null` is treated specially by Powershell in
a pipeline and was resulting in an empty Vector anywhere that `[nil]`
was evaluated. Change all the pipelined uses of `ForEach` to
`ForEach-Object` and wrap the result in an array construct `@( ... )`.
Add a step2 test to make sure that `[nil]` is evaluated correctly.
In common-lisp, self-hosted test4 was failing and it appeared that nil
and empty list () were being conflated. The root cause is that in
common-lisp the form `(list? nil)` was returning true. Fix this in the
core `list?` function.
There was no test for this case so add one to step4 tests.
These implementations were double evaluating the last position of a do
form (off by one). Mostly this is just a performance issue until you
have something with side-effect in the last position such as prn's,
swap!'s or readline's. In self-hosted mode this become apparent with
large chunks of mal code in the last position. The symptoms were
repeated prns and multiple levels of readline being called, etc.
Add a step6 test that uses atoms to test this (should be in step
4 using prn side-effects but it's difficult to match across multiple
lines in a cross-platform way so we test using an atom in step6.
Also, remove cast in Kotlin that was causing a compile warning.
The try block needs to happen and be returned and not continue the TCO
loop. If it does then the successful result of a try block gets
evaluated an extra time so something like this `(try* (list 1) (catch*
e (prn :e e)))` will cause an exception. If an exception occurs, then
the catch block of a try/catch can loop/TCO without issue but not the
initial try form/block.
Newer versions of sbcl now have the same sxhash issue on compound types
as the other common lisp implementations. So always dereference the
underlying base type when generating a hash. This fixes the bug in newer
sbcl that was resulting in `get` and `contains?` not working for
hash-maps.