decay an array into a wildcard standing alone
An array as a value is a pointer to its first element; _ took the array type, and declared a copy that C cannot initialize from it.
This commit is contained in:
10
semen.scm
10
semen.scm
@@ -889,7 +889,15 @@
|
||||
(sex-error form "cannot infer the type of" (second form)))
|
||||
;; `(closure ((int)) int)' is spelled `(struct ƛint_int)'
|
||||
;; everywhere past this point, and is what `parse-type' knows
|
||||
(unify declared (parse-type (resolve-closure-types type)) form)))))
|
||||
(let ((given (parse-type (resolve-closure-types type))))
|
||||
;; an array as a value is a pointer to its first element, which
|
||||
;; is what a `_' standing alone takes; `[_ 3]' asks for an array
|
||||
(unify declared
|
||||
(if (and (tvar? (resolve declared))
|
||||
(array-type? (underlying given)))
|
||||
(decay given)
|
||||
given)
|
||||
form))))))
|
||||
|
||||
;;; `#(0 1 4 9)', as against the compound literal `#(T : ...)'
|
||||
(define (brace-initializer? form)
|
||||
|
||||
Reference in New Issue
Block a user