refuse a pub realization of a spec importers cannot see

It failed in whichever importer named the module before the spec's,
pointing at the module, where a hidden type is refused in the module
already: so is this, the remedy the same.
This commit is contained in:
2026-10-19 14:18:56 +03:00
parent 9e9b729296
commit defc58d503
5 changed files with 60 additions and 4 deletions

View File

@@ -536,6 +536,17 @@ ahead of its pub forms."
(interface-reports? "(pub var n _ 42)" "write it out"))
(test-assert "all of it"
(interface-reports? "(pub var p (* _) 0)" "write it out"))
;; a spec is seen by importers as a type is: pub, or not at all
(test-assert "a pub realization of a private spec is refused"
(interface-reports? (string-append "(spec (shown T) (fn show ((self (* const T))) int))"
"(pub record m ((c int)))"
"(pub realize (shown m) (fn show ((self (* const m))) int (return 1)))")
"importers cannot see this spec; make it pub"))
(test "and of a pub one is not"
'()
(interface-of (string-append "(pub spec (shown T) (fn show ((self (* const T))) int))"
"(pub record m ((c int)))"
"(pub realize (shown m) (fn show ((self (* const m))) int (return 1)))")))
(test "a private one is solved where it is"
'()
(interface-of "(var n _ 42)"))