<commit_before>use v6;
use Test;
BEGIN { @*INC.push: 't/spec/packages' };
use Test::Util;

plan 1;

# this used to segfault in rakudo
is_run(
       'try { 1/0 }; my $x = $!.WHAT; say ~$x',
       { status => 0, out => sub { .chars > 2 }},
       'Can stringify $!.WHAT without segfault',
);



<commit_msg>[t/spec] test for RT #69308, segfault on "say $!:WHAT" in a CATCH block<commit_after>use v6;
use Test;
BEGIN { @*INC.push: 't/spec/packages' };
use Test::Util;

plan 2;

# this used to segfault in rakudo
is_run(
       'try { 1/0 }; my $x = $!.WHAT; say ~$x',
       { status => 0, out => sub { .chars > 2 }},
       'Can stringify $!.WHAT without segfault',
);

is_run(
       'try { 1/0; CATCH { when * { say $!.WHAT } }; };',
       { status => 0, out => sub { .chars > 2 }},
       'Can say $!.WHAT in a CATCH block',
);



{'fraction_non_alphanumeric': 0.19424460431654678, 'fraction_numerical': 0.025179856115107913, 'mean_word_length': 2.523206751054852, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6313562', 'n_tokens_mistral': 362, 'n_tokens_neox': 320, 'n_words': 104}