This was fixed on MoarVM for https://github.com/rakudo/rakudo/issues/1216
Tests added for the variants in this ticket in
https://github.com/perl6/roast/commit/fe57091172
JVM apparently still needs work on this, so the tests are skipped for JVM.
keeping open for JVM fixes.
# New Ticket Created by "Carl Mäsak"
# Please include the string: [perl #114042]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org:443/rt3/Ticket/Display.html?id=114042 >
rn: sub a { my &x = { return }; &x }; my &y = a; &y()
rakudo 138213: OUTPUT«(ti