Skip to content
docs
Arxo ↗

LDC-E1116 — Undeclared cross-file reference

For LLMs5 sections

A package can span several files, and in the explicit authoring mode every file declares which of the other files’ names it uses. The declaration lives in a use self block at the top of the file. When a rule reaches for a name declared in another file without listing it there, the compiler stops at the first use: the reference is real, but the declaration is missing.

The repair is to list the missing name in the file’s use self block. The block names authoring declarations — entities, relations, rules — one per file that uses them. Files that need nothing declare nothing.

run
{"argv": ["check", "$ROOT"], "files": {"law.toml": "[package]\nname = \"demo.diagnostics\"\nversion = \"0.1.0\"\nlanguage = \"0.2\"\nnamespace = \"urn:law:demo:diagnostics\"\n\n[authoring]\nlocal_imports = \"explicit\"\n", "a.law": "language \"law.core\" version \"0.2\";\npackage demo.diagnostics version \"0.1.0\";\nnamespace \"urn:law:demo:diagnostics\";\n\nentity Person;\nrelation adult(p: Person) kind institutional;\nrelation senior(p: Person) kind institutional;\n", "b.law": "language \"law.core\" version \"0.2\";\npackage demo.diagnostics version \"0.1.0\";\nnamespace \"urn:law:demo:diagnostics\";\n\nuse self::{ Person, senior };\n\nrule Senior(p: Person) defeasible {\n when adult(p);\n then senior(p);\n}\n"}, "expect": "LDC-E1116"}
run
{"argv": ["check", "$ROOT"], "files": {"law.toml": "[package]\nname = \"demo.diagnostics\"\nversion = \"0.1.0\"\nlanguage = \"0.2\"\nnamespace = \"urn:law:demo:diagnostics\"\n\n[authoring]\nlocal_imports = \"explicit\"\n", "a.law": "language \"law.core\" version \"0.2\";\npackage demo.diagnostics version \"0.1.0\";\nnamespace \"urn:law:demo:diagnostics\";\n\nentity Person;\nrelation adult(p: Person) kind institutional;\nrelation senior(p: Person) kind institutional;\n", "b.law": "language \"law.core\" version \"0.2\";\npackage demo.diagnostics version \"0.1.0\";\nnamespace \"urn:law:demo:diagnostics\";\n\nuse self::{ Person, senior, adult };\n\nrule Senior(p: Person) defeasible {\n when adult(p);\n then senior(p);\n}\n"}, "expect": null}

The engine reports this in its own wording:

Output
$ROOT/b.law:8:10: error LDC-E1116: `adult` is declared in file $ROOT/a.law and not declared in the `use self` of file $ROOT/b.law: in a package with `local_imports = "explicit"` a reference to another file's declaration is declared (§23.2)

Documentation for Arxo. Writings — blog.arxo.io.

Anonymous visit counts on stats.arxo.io, no cookies.