# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #118023]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118023 >


<lizmat> r: https://gist.github.com/lizmat/5594924
<camelia> rakudo 570d1d: OUTPUT«("Foo::Bar" => {"perl6" =>
{}}).hash␤Nominal type check failed for parameter 'lhs'; expected Any
but got Mu instead␤  in sub METAOP_TEST_ASSIGN:<//> at
src/gen/CORE.setting:13798␤  in sub module2stash at
/tmp/_BTgCQ8SZ_:15␤  in block  at /tmp/_BTgCQ8SZ_:22␤␤»…
<lizmat> I'm stumped, haven't been able to simplify this down further  :-(
<masak> r: (my %h{Any} of Hash){Any} //= my %
<camelia> rakudo 570d1d: OUTPUT«Nominal type check failed for
parameter 'lhs'; expected Any but got Mu instead␤  in sub
METAOP_TEST_ASSIGN:<//> at src/gen/CORE.setting:13798␤  in block  at
/tmp/QD7khTjRjR:1␤␤»
<masak> this is as golf'd as I can get it.
<lizmat> r: my $froms= do { my %h{Any} of Hash;  %h }; $froms<a> //=
do { my %h{Any} of Hash;  %h };  # my golf
<camelia> rakudo 570d1d: OUTPUT«Nominal type check failed for
parameter 'lhs'; expected Any but got Mu instead␤  in sub
METAOP_TEST_ASSIGN:<//> at src/gen/CORE.setting:13798␤  in block  at
/tmp/773hQw7_T5:1␤␤»
<masak> I think that makes it fairly clear that something is Wrong, at least.
<lizmat> seems to me the code generated isn't getting the left hand
side passed to it if the destination is a non-existent hash value on
the left
<lizmat> r: my $froms= do { my %h{Any} of Hash;  %h }; $froms<a>=Any;
$froms<a> //= do { my %h{Any} of Hash;  %h }; say $froms;  # works
<camelia> rakudo 570d1d: OUTPUT«("a" => {}).hash␤»
<lizmat> adding a $h<key>=Any apparently creates a container that //= can find
<lizmat> r: my %h{Any}; %h<a> //= "a"   #golfed shortest
<camelia> rakudo 570d1d: OUTPUT«Nominal type check failed for
parameter 'lhs'; expected Any but got Mu instead␤  in sub
METAOP_TEST_ASSIGN:<//> at src/gen/CORE.setting:13798␤  in block  at
/tmp/Q3e_ebVOMA:1␤␤»
<lizmat> r: my %h{Any}; %h<a>=Any; %h<a> //= "a"   #golfed shortest
<camelia> rakudo 570d1d:  ( no output )
<lizmat> masak: rakudobug?
* masak submits
<lizmat> masak++
<lizmat> BTW, same goes for ||= and &&=
<lizmat> also note that there is no problem if the hash is not typed
<jnthn> Possible patch (please somebody else try it) for the lizmat++
bug: https://gist.github.com/jnthn/5595193
<lizmat> jnthn: I'll try that

Reply via email to