check what a module's importers can see of its types
An importer is given the pub forms and nothing else, so a pub form naming a private type, or one from an import without pub, compiled in its module and failed in every importer with `unknown type name'. The pub forms are checked as the module itself is compiled. A record, struct, union or sum behind a pointer needs only declaring, so its bodyless declaration goes out ahead of them -- the opaque handle that (pub record T) already gave by hand. Held by value it needs its body, and a typedef or an enum has no declaration short of its definition: those are errors at the pub form, saying what would do instead. A name Sex has no declaration for is left to C. An importer may now be handed a declaration after the definition it declares, so a bodyless aggregate no longer replaces known fields. Fixes #57, #58.
This commit is contained in:
@@ -1880,7 +1880,9 @@
|
||||
(name (and (pair? (cdr f)) (symbol? (cadr f)) (cadr f))))
|
||||
;; An anonymous aggregate has a field list where the name would be,
|
||||
;; and nothing can refer to it by name anyway
|
||||
(when name
|
||||
;; ...and a bodyless one adds nothing to what is known: an importer
|
||||
;; may be handed a declaration after the definition it declares
|
||||
(when (and name (not (and (null? (cddr f)) (get-tag-info name))))
|
||||
(case (car f)
|
||||
((struct) (add-struct name form))
|
||||
((union) (add-union name form))
|
||||
|
||||
Reference in New Issue
Block a user