Skip Menu |
Report information
Id: 123191
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: brad <b2gills [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Named enums don't work correctly with a quoted list
Download (untitled) / with headers
text/plain 986b
enum Phonetic ( :Alpha<A>, <Beta Charlie> ); say Phonetic.enums; # "Alpha" => "A", "Beta Charlie" => "B" I believe I have localized the problem to the line (3297) in src/Perl6/Actions.nqp that I have commented out below. The lines I have replaced it with make it work for the test case above. ( Of course it isn't general enough ) I don't know enough NQP to properly fix it myself. if $term_ast.isa(QAST::Op) && $term_ast.name eq '&infix:<,>' { for @($term_ast) { if istype($_.returns(), $Pair) && $_[1].has_compile_time_value { @values.push($_); } elsif $_.has_compile_time_value { @values.push($_); } else { # @values.push($*W.compile_time_evaluate($<term>, $_)); @values.push( $_[0][0] ); # <==== @values.push( $_[0][1] ); # <==== } } }
Subject: flattening/slips ignored inside enum value list
Download (untitled) / with headers
text/plain 862b
This report predates the GLR where flattening behavior changed. Under GLR rules you'd have to flatten the quoted list. However, it appears flattening directly inside the enum arglist is broken: $ perl6 -e 'enum Phonetic ( :Alpha<A>, |<Beta Charlie> ); say Phonetic.enums' Map.new((:Alpha("A"),"Beta Charlie" => "B")) $ perl6 -e 'enum Phonetic ( :Alpha<A>, |("Beta", "Charlie") ); say Phonetic.enums' Map.new((:Alpha("A"),"Beta Charlie" => "B")) # Due to a different RT this workaround doesn't work around unfortunately $ perl6 -e 'enum Phonetic (( :Alpha<A>, |("Beta", "Charlie") )); say Phonetic.enums' Map.new(("Alpha\tA" => 0,:Beta(1),:Charlie(2))) $ perl6 -e 'enum Phonetic (( :Alpha<A>, |<Beta Charlie> )); say Phonetic.enums' Map.new(("Alpha\tA" => 0,:Beta(1),:Charlie(2))) Maybe repurpose this RT as "flattening/slips ignored inside enum value list"


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org