read every trailing array bound as a dimension

[m 1 2] lost its second index, and [int 2 3] came out int 2 x[3]. Each
index now subscripts what the one before it gave, and [int 2 3] declares
what it indexes, int[2][3]. An inline struct's fields, once more than
one bound was looked for, were taken for one; their shape tells them apart.
This commit is contained in:
2026-10-16 15:26:05 +03:00
parent ba807fe9ec
commit 08cb8451ff
7 changed files with 102 additions and 14 deletions

View File

@@ -362,9 +362,10 @@ forms, and what remains."
;; (const * const * const char) -> (const char * const * const)
;; (fn ((int) (float)) void) -> (%fun void ((int) (float)))
(match form
(('¤ . array-type)
(('¤ . _)
(if (array-bound? form)
`(%array ,(walk-type (array-element-type form)) ,(walk-expr (last array-type)))
`(%array ,(walk-type (array-element-type form))
,(walk-expr (array-bound form)))
;; sugar for pointer... Do we really need it? Guess why not,
;; it's a strong semantic cue
`(%array ,(walk-type (array-element-type form)))))