{
  "schema": "ailang/v0",
  "name": "rc_box_drop",
  "imports": [],
  "defs": [
    {
      "kind": "type",
      "name": "Box",
      "vars": [],
      "doc": "Single-cell ADT around an Int. Iter 18c.3 RC fixture: shallow free is sufficient because Box has no boxed children.",
      "ctors": [
        {
          "name": "MkBox",
          "fields": [{ "k": "con", "name": "Int" }]
        }
      ]
    },
    {
      "kind": "fn",
      "name": "main",
      "type": {
        "k": "fn",
        "params": [],
        "ret": { "k": "con", "name": "Unit" },
        "effects": ["IO"]
      },
      "params": [],
      "doc": "Bind a heap-allocated MkBox to `b`, read its Int via match, print it. Under --alloc=rc, codegen emits `ailang_rc_dec(b)` at the let scope close: `b` is unique, has zero consume uses (only the match scrutinee, a borrow), and the body's tail value is the printed Unit, not `b` itself. The Box has no boxed children so shallow `free()` is correct.",
      "body": {
        "t": "let",
        "name": "b",
        "value": {
          "t": "ctor",
          "type": "Box",
          "ctor": "MkBox",
          "args": [{ "t": "lit", "lit": { "kind": "int", "value": 42 } }]
        },
        "body": {
          "t": "match",
          "scrutinee": { "t": "var", "name": "b" },
          "arms": [
            {
              "pat": {
                "p": "ctor",
                "ctor": "MkBox",
                "fields": [{ "p": "var", "name": "x" }]
              },
              "body": {
                "t": "do",
                "op": "io/print_int",
                "args": [{ "t": "var", "name": "x" }]
              }
            }
          ]
        }
      }
    }
  ]
}
