Skip to content

Instantly share code, notes, and snippets.

@Xliff
Created January 9, 2019 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xliff/74a6f61e059df2d6792e7e6900cd9550 to your computer and use it in GitHub Desktop.
Save Xliff/74a6f61e059df2d6792e7e6900cd9550 to your computer and use it in GitHub Desktop.

Here's an interesting bug from Rakudo, that I ran into today. Take this code block:

my $item-type;
$item-type = do given $ii {
  when .key ~~ / ^ '-' /      { 'GTK::SeparatorMenuItem'  }

  # !!! #
  when .value<toggled>:exists |
       .value<check>:exists   |
       .value<toggle>:exists  { 'GTK::CheckMenuItem'      }
  # !!! #

  default                     { 'GTK::MenuItem'           }
}

Looks innocent enough! However when I tried to compile the module that contained this, I got the following error:

===SORRY!===
MVMArray: Index out of bounds

I know for sure it is tied to the when statement between the "# !!! #" comments, but I'm not sure why. I will probably have to re-write this into something else, though.

Just thought I should share.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment