check: over-strict-mode lint (iter 19a)

When a fn-param is annotated (own T) but the body never consumes
it (consume_count == 0) and never destructures it via match, the
linearity pass now emits a Severity::Warning diagnostic with a
form-A-rendered (borrow T) rewrite as suggested_rewrite. Pure
advisory, Decision 10 unchanged.

First Warning-severity diagnostic the typechecker emits; three
CLI exit paths gated on Error-only.

JOURNAL: design entry + iter 19a shipping entry.
This commit is contained in:
2026-05-08 17:56:58 +02:00
parent caefcf996a
commit 41804a39fb
6 changed files with 572 additions and 13 deletions
+26 -3
View File
@@ -399,7 +399,16 @@ fn main() -> Result<()> {
d.message,
);
}
std::process::exit(1);
// Iter 19a: only Error-severity diagnostics fail the
// command. Warning-severity diagnostics (e.g. the
// `over-strict-mode` lint) print to stderr but the
// module is still considered to have typechecked.
if diags
.iter()
.any(|d| matches!(d.severity, ailang_check::Severity::Error))
{
std::process::exit(1);
}
}
let total: usize = ws.modules.values().map(|m| m.defs.len()).sum();
println!(
@@ -430,7 +439,13 @@ fn main() -> Result<()> {
d.message,
);
}
std::process::exit(1);
// Iter 19a: only Error-severity blocks codegen.
if diags
.iter()
.any(|d| matches!(d.severity, ailang_check::Severity::Error))
{
std::process::exit(1);
}
}
let ir = ailang_codegen::lower_workspace(&ws)?;
match out {
@@ -1653,7 +1668,15 @@ fn build_to(
d.message,
);
}
std::process::exit(1);
// Iter 19a: only Error-severity blocks the build. Warning-
// severity diagnostics (e.g. `over-strict-mode`) print but
// do not abort.
if diags
.iter()
.any(|d| matches!(d.severity, ailang_check::Severity::Error))
{
std::process::exit(1);
}
}
// Iter 16b.3: run `lift_letrecs` per module on the post-desugar
// form. Codegen's internal desugar pass is idempotent on a