1
0
mirror of https://github.com/janet-lang/janet synced 2025-09-12 07:46:09 +00:00

Address #1121 - disallow extra splices.

This turns splices that are ignored into compiler errors. Other
alternatives here should also be considered, for example making this
a compiler warning rather than an error. For example, the latest
spork as of a3ee63c137ee3234987dbbca71b566994ff8ae8c has an error of this
kind, but the resulting program does work correctly.

Also disallow splice propagation - code of the
form (+ 1 (do ;[2 3 4]) 5).
This commit is contained in:
Calvin Rose
2023-05-06 12:08:07 -05:00
parent 4cc4a9d38b
commit 7d57f87007
6 changed files with 33 additions and 1 deletions

View File

@@ -24,6 +24,11 @@
(def errsym (keyword (gensym)))
~(assert (= ,errsym (try (do ,;forms) ([_] ,errsym))) ,msg))
(defn check-compile-error
[form]
(def result (compile form))
(assert (table? result) (string/format "expected compilation error for %j, but compiled without error" form)))
(defmacro assert-no-error
[msg & forms]
(def errsym (keyword (gensym)))