# New Ticket Created by  Richard Hainsworth 
# Please include the string:  [perl #120956]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=120956 >


The following snippet illustrates code that
a) compiles correctly
b) works without perl6-debug
c) will not load into perl6-debug unless the module is compiled.

The problem occurs when a 'when' clause has a comment and is followed by 
another 'when' or 'default' clause.

The work around is to remove or relocate the comments to the end of the 
'default' clause or to the 'given' line.

As I wrote this, I realised that the module was not necessary, but the 
failure is more spectacular - so I left it.

All that is necessary is for a 'when' clause to have a comment on the 
end of the line and to be followed by another 'when' or 'default', eg.

when / ss / { say 'something' ; succeed } # comment
default { say 'something else' }

This works fine when run, but causes perl6-debug to issue a 'confused' 
error.

In other words, it appears to be a debug bug rather than a rakudo bug.

I am using Rakudo * on Ubuntu.

$ perl6 -v
This is perl6 version 2013.11 built on parrot 5.9.0 revision 0
$ perl6-debug -v
This is perl6 version  built on parrot 5.9.0 revision 0

$ perl6 -v
This is perl6 version 2013.11 built on parrot 5.9.0 revision 0
$ perl6-debug -v
This is perl6 version  built on parrot 5.9.0 revision 0
$
$ cat goo.p6
use v6;
use NewClass;
$
$ cat NewClass.pm6
use v6;
class NewClass is export {
   method a {
     given 'a' {
       when /^ 'ss' / { succeed } # comment
       default {}
     }
   }
}
$
$ perl6 -I. --target=pir NewClass.pm6 > NewClass.pir
$ perl6-debug -I. goo.p6
 >>> LOADING goo.p6
$
$ rm *.pir
$ perl6-debug -I. goo.p6
 >>> LOADING goo.p6
 >>> LOADING /home/richard/development/Micro_Macro/test/NewClass.pm6
Null PMC access in get_attr_str()
current instr.: '' pc 5982 (src/gen/perl6-moduleloader.pir:2536) 
(gen/parrot/ModuleLoader.nqp:274)
called from Sub '' pc 4896 (src/gen/perl6-moduleloader.pir:2075) 
(gen/parrot/ModuleLoader.nqp:226)
called from Sub 'load_module' pc 4073 
(src/gen/perl6-moduleloader.pir:1733) (gen/parrot/ModuleLoader.nqp:215)
called from Sub 'load_module' pc 5768 
(src/gen/perl6-symboltable.pir:2306) (src/Perl6/World.nqp:334)
called from Sub '' pc 86351 (src/gen/perl6-grammar.pir:30852) 
(src/Perl6/Grammar.nqp:1309)
called from Sub '' pc 86077 (src/gen/perl6-grammar.pir:30738) 
(src/Perl6/Grammar.nqp:1304)
called from Sub 'statement_control:sym<use>' pc 84785 
(src/gen/perl6-grammar.pir:30225) (src/Perl6/Grammar.nqp:1258)
called from Sub '!protoregex' pc 12863 
(gen/parrot/stage2/QRegex.pir:5259) (gen/parrot/stage2/QRegex.nqp:746)
called from Sub 'statement_control' pc 71336 
(src/gen/perl6-grammar.pir:26329) (src/Perl6/Grammar.nqp:1155)
called from Sub 'statement' pc 62523 (src/gen/perl6-grammar.pir:23108) 
(src/Perl6/Grammar.nqp:1037)
called from Sub 'statementlist' pc 59870 
(src/gen/perl6-grammar.pir:22274) (src/Perl6/Grammar.nqp:1005)
called from Sub '' pc 12130 
(modules/rakudo-debugger/perl6-debug.pir:4909) 
(modules/rakudo-debugger/bin/perl6-debug.nqp:389)
called from Sub 'statementlist' pc 12064 
(modules/rakudo-debugger/perl6-debug.pir:4885) 
(modules/rakudo-debugger/bin/perl6-debug.nqp:382)
called from Sub 'comp_unit' pc 52582 (src/gen/perl6-grammar.pir:19294) 
(src/Perl6/Grammar.nqp:796)
called from Sub 'comp_unit' pc 12633 
(modules/rakudo-debugger/perl6-debug.pir:5121) 
(modules/rakudo-debugger/bin/perl6-debug.nqp:405)
called from Sub 'TOP' pc 17841 (src/gen/perl6-grammar.pir:7221) 
(src/Perl6/Grammar.nqp:345)
called from Sub 'parse' pc 20976 (gen/parrot/stage2/QRegex.pir:8408) 
(gen/parrot/stage2/QRegex.nqp:1253)
called from Sub 'parse' pc 33805 (gen/parrot/stage2/NQPHLL.pir:13321) 
(gen/parrot/stage2/NQPHLL.nqp:1425)
called from Sub '' pc 33222 (gen/parrot/stage2/NQPHLL.pir:13107) 
(gen/parrot/stage2/NQPHLL.nqp:1380)
called from Sub 'compile' pc 32999 (gen/parrot/stage2/NQPHLL.pir:13018) 
(gen/parrot/stage2/NQPHLL.nqp:1372)
called from Sub 'eval' pc 28505 (gen/parrot/stage2/NQPHLL.pir:11151) 
(gen/parrot/stage2/NQPHLL.nqp:1129)
called from Sub 'eval' pc 13668 
(modules/rakudo-debugger/perl6-debug.pir:5543) 
(modules/rakudo-debugger/bin/perl6-debug.nqp:449)
called from Sub 'evalfiles' pc 31923 
(gen/parrot/stage2/NQPHLL.pir:12581) (gen/parrot/stage2/NQPHLL.nqp:1339)
called from Sub 'command_eval' pc 30665 
(gen/parrot/stage2/NQPHLL.pir:12092) (gen/parrot/stage2/NQPHLL.nqp:1276)
called from Sub 'command_eval' pc 369 (src/gen/perl6-compiler.pir:194) 
(src/Perl6/Compiler.nqp:17)
called from Sub 'command_line' pc 29669 
(gen/parrot/stage2/NQPHLL.pir:11680) (gen/parrot/stage2/NQPHLL.nqp:1218)
called from Sub 'MAIN' pc 779 
(modules/rakudo-debugger/perl6-debug.pir:289) 
(modules/rakudo-debugger/bin/perl6-debug.nqp:499)
called from Sub '' pc 226 (modules/rakudo-debugger/perl6-debug.pir:100) 
(modules/rakudo-debugger/bin/perl6-debug.nqp:1)
called from Sub '' pc 18407 
(modules/rakudo-debugger/perl6-debug.pir:7084) 
(modules/rakudo-debugger/bin/perl6-debug.nqp:449)

thrown from:
current instr.: '' pc 376105 (src/gen/p-CORE.setting.pir:158719) 
(gen/parrot/CORE.setting:9209)
called from Sub 'at_key' pc 377173 (src/gen/p-CORE.setting.pir:159212) 
(gen/parrot/CORE.setting:9273)
called from Sub 'postcircumfix:<{ }>' pc 75370 
(src/gen/p-CORE.setting.pir:29941) (gen/parrot/CORE.setting:2465)
called from Sub 'postcircumfix:<{ }>' pc 75340 
(src/gen/p-CORE.setting.pir:29918) (gen/parrot/CORE.setting:2461)
called from Sub '' pc 4712 
(/home/richard/development/perl6/rakudo-star-2013.11/install/lib/parrot/5.9.0/languages/perl6/lib/Debugger/UI/CommandLine.pir:1770)
 
(/home/richard/development/perl6/rakudo-star-2013.11/install/lib/parrot/5.9.0/languages/perl6/lib/Debugger/UI/CommandLine.pm:732)
called from Sub '' pc 328412 (src/gen/p-CORE.setting.pir:138334) 
(gen/parrot/CORE.setting:7243)
called from Sub 'reify' pc 327392 (src/gen/p-CORE.setting.pir:137963) 
(gen/parrot/CORE.setting:7220)
called from Sub '' pc 325749 (src/gen/p-CORE.setting.pir:137230) 
(gen/parrot/CORE.setting:7138)
called from Sub 'reify' pc 324936 (src/gen/p-CORE.setting.pir:136912) 
(gen/parrot/CORE.setting:7110)
called from Sub 'gimme' pc 334305 (src/gen/p-CORE.setting.pir:140951) 
(gen/parrot/CORE.setting:7566)
called from Sub 'sink' pc 346020 (src/gen/p-CORE.setting.pir:145670) 
(gen/parrot/CORE.setting:7976)
called from Sub 'unhandled' pc 4518 
(/home/richard/development/perl6/rakudo-star-2013.11/install/lib/parrot/5.9.0/languages/perl6/lib/Debugger/UI/CommandLine.pir:1697)
 
(/home/richard/development/perl6/rakudo-star-2013.11/install/lib/parrot/5.9.0/languages/perl6/lib/Debugger/UI/CommandLine.pm:726)
called from Sub '' pc 5982 (src/gen/perl6-moduleloader.pir:2536) 
(gen/parrot/ModuleLoader.nqp:274)
called from Sub '' pc 4896 (src/gen/perl6-moduleloader.pir:2075) 
(gen/parrot/ModuleLoader.nqp:226)
called from Sub 'load_module' pc 4073 
(src/gen/perl6-moduleloader.pir:1733) (gen/parrot/ModuleLoader.nqp:215)
called from Sub 'load_module' pc 5768 
(src/gen/perl6-symboltable.pir:2306) (src/Perl6/World.nqp:334)
called from Sub '' pc 86351 (src/gen/perl6-grammar.pir:30852) 
(src/Perl6/Grammar.nqp:1309)
called from Sub '' pc 86077 (src/gen/perl6-grammar.pir:30738) 
(src/Perl6/Grammar.nqp:1304)
called from Sub 'statement_control:sym<use>' pc 84785 
(src/gen/perl6-grammar.pir:30225) (src/Perl6/Grammar.nqp:1258)
called from Sub '!protoregex' pc 12863 
(gen/parrot/stage2/QRegex.pir:5259) (gen/parrot/stage2/QRegex.nqp:746)
called from Sub 'statement_control' pc 71336 
(src/gen/perl6-grammar.pir:26329) (src/Perl6/Grammar.nqp:1155)
called from Sub 'statement' pc 62523 (src/gen/perl6-grammar.pir:23108) 
(src/Perl6/Grammar.nqp:1037)
called from Sub 'statementlist' pc 59870 
(src/gen/perl6-grammar.pir:22274) (src/Perl6/Grammar.nqp:1005)
called from Sub '' pc 12130 
(modules/rakudo-debugger/perl6-debug.pir:4909) 
(modules/rakudo-debugger/bin/perl6-debug.nqp:389)
called from Sub 'statementlist' pc 12064 
(modules/rakudo-debugger/perl6-debug.pir:4885) 
(modules/rakudo-debugger/bin/perl6-debug.nqp:382)
called from Sub 'comp_unit' pc 52582 (src/gen/perl6-grammar.pir:19294) 
(src/Perl6/Grammar.nqp:796)
called from Sub 'comp_unit' pc 12633 
(modules/rakudo-debugger/perl6-debug.pir:5121) 
(modules/rakudo-debugger/bin/perl6-debug.nqp:405)
called from Sub 'TOP' pc 17841 (src/gen/perl6-grammar.pir:7221) 
(src/Perl6/Grammar.nqp:345)
called from Sub 'parse' pc 20976 (gen/parrot/stage2/QRegex.pir:8408) 
(gen/parrot/stage2/QRegex.nqp:1253)
called from Sub 'parse' pc 33805 (gen/parrot/stage2/NQPHLL.pir:13321) 
(gen/parrot/stage2/NQPHLL.nqp:1425)
called from Sub '' pc 33222 (gen/parrot/stage2/NQPHLL.pir:13107) 
(gen/parrot/stage2/NQPHLL.nqp:1380)
called from Sub 'compile' pc 32999 (gen/parrot/stage2/NQPHLL.pir:13018) 
(gen/parrot/stage2/NQPHLL.nqp:1372)
called from Sub 'eval' pc 28505 (gen/parrot/stage2/NQPHLL.pir:11151) 
(gen/parrot/stage2/NQPHLL.nqp:1129)
called from Sub 'eval' pc 13668 
(modules/rakudo-debugger/perl6-debug.pir:5543) 
(modules/rakudo-debugger/bin/perl6-debug.nqp:449)
called from Sub 'evalfiles' pc 31923 
(gen/parrot/stage2/NQPHLL.pir:12581) (gen/parrot/stage2/NQPHLL.nqp:1339)
called from Sub 'command_eval' pc 30665 
(gen/parrot/stage2/NQPHLL.pir:12092) (gen/parrot/stage2/NQPHLL.nqp:1276)
called from Sub 'command_eval' pc 369 (src/gen/perl6-compiler.pir:194) 
(src/Perl6/Compiler.nqp:17)
called from Sub 'command_line' pc 29669 
(gen/parrot/stage2/NQPHLL.pir:11680) (gen/parrot/stage2/NQPHLL.nqp:1218)
called from Sub 'MAIN' pc 779 
(modules/rakudo-debugger/perl6-debug.pir:289) 
(modules/rakudo-debugger/bin/perl6-debug.nqp:499)
called from Sub '' pc 226 (modules/rakudo-debugger/perl6-debug.pir:100) 
(modules/rakudo-debugger/bin/perl6-debug.nqp:1)
called from Sub '' pc 18407 
(modules/rakudo-debugger/perl6-debug.pir:7084) 
(modules/rakudo-debugger/bin/perl6-debug.nqp:449)
$
$

Reply via email to