1
0
forked from alex-eg/sex

read a var's type as a type, not as a call

`walk-parts' walked the whole `var' form, and a `fn' type's parameter
list is shaped like a call: `(fn ((c int)) int)' came out as
`int (*fp)(c int)'. A closure literal had no type, so calling one in
place missed the rewrite; sextest fed sexc symbols Sex cannot read.
This commit is contained in:
2026-09-30 23:20:55 +03:00
parent e87463be87
commit fe72a109bf
4 changed files with 153 additions and 13 deletions

View File

@@ -86,8 +86,14 @@
(compiled-file (create-temporary-file)))
;; `process' returns one record; `process-input-port' is named from
;; the child's side, so it is the port we write to.
;;
;; Sex has no symbol escaping -- `|' is an operator there, not a
;; quote -- so the forms go out the way they were written. Left to
;; escape, `||' would leave here as `|\|\||' and reach sexc as a
;; different symbol.
(let* ((proc (process compiler (append (list "-o" compiled-file) flags)))
(sexc-stdin (process-input-port proc)))
(symbol-escape #f)
(with-output-to-port sexc-stdin
(fn (map (fn (fmt #t x)) src)))
(close-output-port sexc-stdin)