Iter 5b: Cross-Module-Typcheck mit qualifizierten Verweisen

Neue API check_workspace(&Workspace) -> Vec<Diagnostic>; check_module
hebt das Modul intern in einen Trivial-Workspace. Term::Var mit genau
einem Punkt im Namen ist ein qualifizierter Verweis <prefix>.<def>,
aufgelöst über Import-Map (alias-oder-modulname → echter Modulname).
Drei neue Diagnostic-Codes: unknown-module, unknown-import,
invalid-def-name. ail check lädt jetzt immer via load_workspace;
Loader-Fehler werden im JSON-Modus zu strukturierten Diagnostics
(module-not-found, module-cycle, …). DESIGN.md und JOURNAL.md
dokumentieren die Konvention. Hash-Stabilität: alle ir_snapshot_*-
Tests bitidentisch grün, kein neuer AST-Knoten.
This commit is contained in:
2026-05-07 11:31:57 +02:00
parent 3451b5bd15
commit b2878fe655
10 changed files with 601 additions and 67 deletions
+29
View File
@@ -0,0 +1,29 @@
{
"schema": "ailang/v0",
"name": "ws_broken",
"imports": [
{ "module": "ws_lib" }
],
"defs": [
{
"kind": "fn",
"name": "main",
"type": {
"k": "fn",
"params": [],
"ret": { "k": "con", "name": "Int" },
"effects": []
},
"params": [],
"doc": "Iter 5b negative fixture: ruft ws_lib.bogus auf — Modul existiert, Def nicht. Triggert `unknown-import`.",
"body": {
"t": "app",
"fn": { "t": "var", "name": "ws_lib.bogus" },
"args": [
{ "t": "lit", "lit": { "kind": "int", "value": 1 } },
{ "t": "lit", "lit": { "kind": "int", "value": 2 } }
]
}
}
]
}
+9 -2
View File
@@ -15,12 +15,19 @@
"effects": ["IO"]
},
"params": [],
"doc": "Iter 5a fixture: Eintrittsmodul, importiert ws_lib (noch ungenutzt — Cross-Module-Aufruf folgt in 5b/5c).",
"doc": "Iter 5b fixture: ruft ws_lib.add auf, druckt das Ergebnis. So ist Cross-Module-Typcheck am Beispiel beobachtbar.",
"body": {
"t": "do",
"op": "io/print_int",
"args": [
{ "t": "lit", "lit": { "kind": "int", "value": 0 } }
{
"t": "app",
"fn": { "t": "var", "name": "ws_lib.add" },
"args": [
{ "t": "lit", "lit": { "kind": "int", "value": 2 } },
{ "t": "lit", "lit": { "kind": "int", "value": 3 } }
]
}
]
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"schema": "ailang/v0",
"name": "ws_unknown_module",
"imports": [],
"defs": [
{
"kind": "fn",
"name": "main",
"type": {
"k": "fn",
"params": [],
"ret": { "k": "con", "name": "Int" },
"effects": []
},
"params": [],
"doc": "Iter 5b negative fixture: kein Import, aber qualifizierter Verweis `nope.x`. Triggert `unknown-module`.",
"body": {
"t": "var",
"name": "nope.x"
}
}
]
}