Commit dc64aa3
committed
feat(diag): report a missing std-namespace import in Xi, not C
Extends missing-import diagnostics to namespaced std modules. `json.foo(...)`
without `import "std/json.xi"` now reports
`file.xi:3: error: json.foo(...) — the 'json' namespace isn't imported; add:
import "std/json.xi"` instead of leaking `undeclared identifier 'json'`.
Hooked at the identifier fallback, guarded so it only fires when: the name is a
known std namespace (json/yaml/xml/crypto/math/text/bytes/net/fs/path/time/http/
io/proc/vec/web), it's followed by `.`, it isn't a local var, and no `<ns>__<fn>`
function exists (i.e. the namespace really isn't imported) — so imported
namespaces and locals are never flagged. Verified across every example (0 false
positives); the check also caught a genuine latent bug — thread_demo used
int_to_string without importing std/convert — now fixed. Fixpoint byte-identical;
22 test files pass.1 parent abf66f5 commit dc64aa3
3 files changed
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
514 | 523 | | |
515 | 524 | | |
516 | 525 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
320 | 342 | | |
321 | 343 | | |
322 | 344 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
0 commit comments