{"atom":"regression/package-then-role-coexist","family":"regression","slug":"package-then-role-coexist","header":{"atom":"regression/package-then-role-coexist","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/package-then-role-coexist.raku","counts":{"a":0,"f":0,"d":0,"c":0,"r":1,"n":0},"files":["atoms/regression/package-then-role-coexist.grid"],"records":[["0001","","# Regression: a bare `package`/`module` block is a weak namespace declaration\n# and may coexist with a later `class`/`role`/`grammar` of the same name that\n# refines it. Surfaced by Cro::ResourceIdentifier (a `package Foo { our sub … }`\n# followed by `role Foo { … }` in the same file). A genuine class/class or\n# role/role clash must STILL be rejected.\nmy $ok = 0; my $n = 0;\nsub ck($got, $want, $desc) {\n    $n++;\n    if $got eqv $want { $ok++ }\n    else { say \"FAIL: $desc — {$got.raku} vs {$want.raku}\" }\n}\n\n# package then role, with an our-sub in the package namespace\npackage P1 { our sub helper() { 40 } }\nrole P1 { has $.x; method m() { 2 } }\nclass C1 does P1 { }\nck(C1.new(x => 9).x, 9, 'package-then-role: attribute composed');\nck(C1.new.m, 2, 'package-then-role: method composed');\nck(P1::helper(), 40, 'package-then-role: our-sub still callable');\n\n# module then class\nmodule P2 { }\nclass P2 { method g() { 7 } }\nck(P2.new.g, 7, 'module-then-class refines the name');\n\n# role then package (reverse order)\nrole P3 { method g() { 5 } }\npackage P3 { }\nclass C3 does P3 { }\nck(C3.new.g, 5, 'role-then-package still composes');\n\nsay $ok == $n ?? 'PASS' !! \"FAIL ($ok/$n)\";","output PASS","r",["exit 1","PASS"],{"v":"disputed","w":"the reference implementation does not satisfy the program's own contract here (exit 0 with a last line of PASS) — it needs modules that are not installed, or exercises something only one engine implements; there is no reference observation to rule against","d":"2026-08-14 against rakudo-2026.07"},[["budget","20s"]]]]}