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:
@@ -36,4 +36,4 @@ pub mod parse;
|
||||
pub mod print;
|
||||
|
||||
pub use parse::{parse, parse_term, ParseError};
|
||||
pub use print::{print, term_to_form_a};
|
||||
pub use print::{print, term_to_form_a, type_to_form_a};
|
||||
|
||||
@@ -43,6 +43,16 @@ pub fn term_to_form_a(t: &Term) -> String {
|
||||
out
|
||||
}
|
||||
|
||||
/// Iter 19a: render a [`Type`] as form-A. Used by diagnostics that want
|
||||
/// to suggest a relaxed signature (e.g. `over-strict-mode` shows the
|
||||
/// `(fn-type ...)` with `(borrow T)` in place of `(own T)`). Output is
|
||||
/// the same shape that appears as the `type` slot of a `(fn ...)` def.
|
||||
pub fn type_to_form_a(t: &Type) -> String {
|
||||
let mut out = String::new();
|
||||
write_type(&mut out, t);
|
||||
out
|
||||
}
|
||||
|
||||
// ---- helpers --------------------------------------------------------------
|
||||
|
||||
fn indent(out: &mut String, level: usize) {
|
||||
|
||||
Reference in New Issue
Block a user