refuse _ in a pub var's type

Importers declare a pub var from its type alone, with nothing to solve
a wildcard against, so (pub var n _ 42) reached them as extern _ n.
This commit is contained in:
2026-10-16 17:04:20 +03:00
parent c0738ff965
commit 669b3cdc7b
2 changed files with 24 additions and 0 deletions

View File

@@ -532,6 +532,15 @@ ahead of its pub forms."
(test "nor a private fn's"
'()
(interface-of "(record cell ((v int))) (fn f ((c cell)) void)"))
;; importers are given the declaration, not the initializer, so `_'
;; reached them unsolved: `extern _ n'
(test-assert "a pub var's type is written out"
(interface-reports? "(pub var n _ 42)" "write it out"))
(test-assert "all of it"
(interface-reports? "(pub var p (* _) 0)" "write it out"))
(test "a private one is solved where it is"
'()
(interface-of "(var n _ 42)"))
(test-assert "held by value it is an error"
(interface-reports? "(record cell ((v int))) (pub record shape ((c cell)))"
"held by value"))