{"atom":"regression/parameter-why","family":"regression","slug":"parameter-why","header":{"atom":"regression/parameter-why","kind":"whole-program — a minimal repro, not yet reduced to an atom","source":"curated"},"axes":null,"cols":null,"engines":["rakudo-2026.07","rakupp-3.14.0"],"kinds":["ref","pp"],"defFrom":"rakupp:t/regression/parameter-why.raku","counts":{"a":1,"f":0,"d":0,"c":0,"r":0,"n":0},"files":["atoms/regression/parameter-why.grid"],"records":[["0001","","# Parameter-level declarator docs reach introspection: a param's trailing\n# `#= doc` (or leading `#|`) answers .signature.params[N].WHY, as in Rakudo.\n# The doc was always captured (Param.pod drives $*USAGE's option list) but\n# never plumbed into the reflected Parameter object — .WHY answered Nil.\n# Spun off from the v3 CLI step-2 work (the MAIN-usage fixes, issue #17);\n# oracle-verified against Rakudo 2026.07. Passes under both engines.\n\nmy $fails = 0;\nsub check(Str $desc, $got, $want) {\n    if $got eq $want {\n        say \"ok - $desc\";\n    }\n    else {\n        $fails++;\n        say \"not ok - $desc\";\n        note \"GOT [{$got}] WANT [{$want}]\";\n    }\n}\n\nsub g(\n    Int $a,  #= a doc\n    Str :$b, #= b doc\n) { }\ncheck('positional #= doc',      (&g.signature.params[0].WHY // 'Nil').gist, 'a doc');\ncheck('named #= doc',           (&g.signature.params[1].WHY // 'Nil').gist, 'b doc');\n\nsub h(\n    #| lead doc\n    Int $c,\n    Int $d,\n) { }\ncheck('leading #| documents the param below it',\n      (&h.signature.params[0].WHY // 'Nil').gist, 'lead doc');\ncheck('an undocumented param answers Nil',\n      (&h.signature.params[1].WHY // 'Nil').gist, 'Nil');\n\n#| the routine itself\nsub k(Int $e) { }\ncheck('the routine doc stays the routine doc', (&k.WHY // 'Nil').gist, 'the routine itself');\ncheck('…and does not leak into its params',\n      (&k.signature.params[0].WHY // 'Nil').gist, 'Nil');\n\nsay $fails == 0 ?? 'PASS' !! 'FAIL';\nexit($fails ?? 1 !! 0);","output ok - positional #= doc\nok - named #= doc\nok - leading #| documents the param below it\nok - an undocumented param answers Nil\nok - the routine doc stays the routine doc\nok - …and does not leak into its params\nPASS","a",["ok - positional #= doc …(7 lines)","ok - positional #= doc …(7 lines)"],0,[["budget","20s"]]]]}