50b68267fe
Closes the 19a/19a.1/19b arc. Corpus signal from 19a.1 (5/65
fixtures fire over-strict-mode, all deliberate RC codegen-test
fixtures) justified shipping the suppress mechanism end-to-end.
Schema: Suppress { code, because } on FnDef. Pre-19b hashes
bit-identical via skip_serializing_if. Typechecker drops matching
diagnostics; empty 'because' is Error severity; wrong codes are
silent no-ops (open-set registry).
Form-A: (suppress (code "...") (because "...")) clause, parser
+ printer round-trip clean. Form-B: '// @suppress <code>: <reason>'
above the doc string, lossless contract metadata.
5 RC fixtures migrated (.ail.json + .ailx + .prose.txt). Corpus
signal: 5/65 -> 0/65. Lint still fires on any future fn that's
accidentally over-strict without an authored reason.
Test counts: ailang-check 55->61, ailang-core 26->28, ailang-surface
21->26, ailang-prose 49->52, e2e 70 unchanged.
Known debt: .ailx comment headers lost on regen (ail render's
contract excludes comments); parse_suppress_attr accepts
duplicate code/because attrs without diagnose (bounded by canonical
print order).
23 lines
964 B
Plaintext
23 lines
964 B
Plaintext
(module rc_app_let_partial_drop_leak
|
|
(data Wrap
|
|
(ctor MkWrap (con Int)))
|
|
(data Cell
|
|
(ctor MkCell (con Wrap) (con Wrap)))
|
|
(data Pair
|
|
(ctor MkPair (con Cell) (con Cell)))
|
|
(fn build_pair
|
|
(type (fn-type (params (con Int)) (ret (own (con Pair)))))
|
|
(params n)
|
|
(body (term-ctor Pair MkPair (term-ctor Cell MkCell (term-ctor Wrap MkWrap n) (term-ctor Wrap MkWrap 2)) (term-ctor Cell MkCell (term-ctor Wrap MkWrap 3) (term-ctor Wrap MkWrap 4)))))
|
|
(fn use_cell
|
|
(suppress (code "over-strict-mode") (because "RC codegen test: shape used to feed App-bound let-close partial-drop into use_cell"))
|
|
(type (fn-type (params (own (con Cell))) (ret (con Int))))
|
|
(params c)
|
|
(body (match c
|
|
(case (pat-ctor MkCell w1 w2) 1))))
|
|
(fn main
|
|
(type (fn-type (params) (ret (con Unit)) (effects IO)))
|
|
(params)
|
|
(body (let p (app build_pair 1) (do io/print_int (match p
|
|
(case (pat-ctor MkPair a _) (app use_cell a))))))))
|