✓
Passing This code compiles and runs correctly.
Code
// std/invariants: a rule declared in the AST via [norun] mechanics surfaces
// through the module's own reader. Pins the declaration surface — both
// dispositions — and the `invariants` command listing them with name,
// disposition, and rule text.
//
// Run: koruc input.kz invariants
~import std/invariants
~std/invariants:inferred {
"name": "comment-language",
"tags": ["git-gate"],
"rule": "Comments are written in English, not Norwegian."
}
~std/invariants:aspirational {
"name": "store-sweep-vectorizes",
"rule": "The store sweep loop compiles to vectorized code."
}
~tor main {}
~proc main|zig {
}
~main()
Flows
flow ~inferred click a branch to expand · @labels scroll to their anchor
inferred (source: "name": "comment-language",
"tags": ["git-gate"],
"rule": "Comments are written in English, not Norwegian.")
flow ~aspirational click a branch to expand · @labels scroll to their anchor
aspirational (source: "name": "store-sweep-vectorizes",
"rule": "The store sweep loop compiles to vectorized code.")
flow ~main click a branch to expand · @labels scroll to their anchor
main
Test Configuration
Post-validation Script:
#!/bin/bash
# `invariants` must REPORT each declaration with its disposition and rule —
# the declaration surface and its reader ship together.
set -e
OUT=$(koruc "$KORU_INPUT" invariants 2>&1)
echo "$OUT" | grep -q "comment-language (inferred)" \
|| { echo "FAIL: inferred invariant not listed with its disposition"; echo "$OUT"; exit 1; }
echo "$OUT" | grep -q "store-sweep-vectorizes (aspirational)" \
|| { echo "FAIL: aspirational invariant not listed with its disposition"; echo "$OUT"; exit 1; }
echo "$OUT" | grep -q "Comments are written in English, not Norwegian." \
|| { echo "FAIL: rule text not reported"; echo "$OUT"; exit 1; }
echo "$OUT" | grep -q "\[git-gate\]" \
|| { echo "FAIL: git-gate tag not reported"; echo "$OUT"; exit 1; }
echo "=== Test passed: both dispositions listed with rules ==="