count a unit among its own imports

Two modules importing each other with pub hand the unit its own
interface back, and its types were defined twice.
This commit is contained in:
2026-10-19 14:18:56 +03:00
parent 2d7f58e15e
commit 2b88286411
6 changed files with 46 additions and 3 deletions

View File

@@ -0,0 +1,8 @@
;;; Each imports the other with pub, so either one compiled pastes the
;;; other's interface, which imports it back. b holds an ra by value, so
;;; ra is defined before b is imported, as C needs it in one unit
(pub record ra ((x int)))
(pub import b)
(pub fn make-ra ((x int)) ra (return #(ra : x)))

View File

@@ -0,0 +1,5 @@
(pub import a)
(pub record rb ((a ra) (y int)))
(pub fn make-rb ((x int) (y int)) rb (return #(rb : (make-ra x) y)))