nx_diamond_probe.nx source
↩ module page · 37 lines · 1527 B
1// nx_diamond_probe.nx -- ISOLATED IMPORT-DEDUP PROBE (2026-07-31), top of the diamond.
2//
3// QUESTION: does nx_cc include a module TWICE when it is reachable by TWO import paths?
4// WHY: nx_cc_ingest fails `duplicate definition of arena_new` while its ENTIRE closure contains
5// exactly ONE runtime import (nx_gzip_wrap -> nx_runtime.nx). If dedup is path/order sensitive,
6// a diamond re-emits the second arrival. nx_cc_ingest has exactly that shape: it imports
7// nx_x509_trust_store DIRECTLY and again via nx_https_fetch_follow.
8//
9// THE DIAMOND: probe -> leaf (direct arm)
10// probe -> mid -> leaf (indirect arm)
11//
12// EXPECTED IF DEDUP IS CORRECT: builds clean, exit 0, run prints 7/8.
13// EXPECTED IF DEDUP IS BROKEN: `duplicate definition of 'dl_value'` -- which would REPRODUCE the
14// nx_cc_ingest class in 3 tiny files and hand the compiler lane a minimal repro.
15// Either outcome is informative; a NEGATIVE result narrows the search rather than wasting it.
16import "nx_diamond_leaf.nx"
17import "nx_diamond_mid.nx"
18
19func dp_puts(s: *u8) -> i64 {
20 var n: i64 = 0
21 while s[n] != (0 as u8) { n = n + 1 }
22 sys_write(1, s, n)
23 return 0
24}
25
26func main(argc: i64, argv: *i64) -> i64 {
27 let a: i64 = dl_value()
28 let b: i64 = dm_value()
29 if a == 7 { if b == 8 {
30 dp_puts("DIAMOND-PROBE OK: dedup handled the diamond (leaf included once)\n" as *u8)
31 sys_exit(0)
32 return 0
33 } }
34 dp_puts("DIAMOND-PROBE UNEXPECTED VALUES\n" as *u8)
35 sys_exit(1)
36 return 1
37}