forked from alex-eg/sex
refuse a macro defined after a call to it
The call was compiled as a function's, and the macro went unused there without a word.
This commit is contained in:
@@ -335,6 +335,14 @@
|
||||
"macro takes at least this many arguments many 1"))
|
||||
(test-assert "while it may take any more"
|
||||
(emits? "(defmacro (many x . more) x) (fn f () int (return (many 1 2 3)))" "return 1;"))
|
||||
;; a call before the macro is defined is a function call, and the
|
||||
;; macro defined after it went unused there without a word
|
||||
(test-assert "a macro defined after a call to it is refused"
|
||||
(reports? "(fn f () int (return (later 1)))\n(defmacro (later x) x)"
|
||||
"codegen.sex:2: a macro defined after a call to it"))
|
||||
(test-assert "naming where the call is"
|
||||
(reports? "(fn f () int\n (return (later 1)))\n(defmacro (later x) x)"
|
||||
"/codegen.sex:2\""))
|
||||
(test-assert "an error in a macro's body names the call"
|
||||
(reports? "(defmacro (boom x) (error \"no good\" x))\n(fn f () int (return (boom 1)))"
|
||||
"codegen.sex:2: expanding boom: no good")))
|
||||
|
||||
Reference in New Issue
Block a user