New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use a where clause on an attribute without surrounding name and where clause in parentheses in Rakudo #1854
Comments
From @masak<masak> std: class A { has Int $.color where 1|2; } |
From @cokeNo change in year+. -- |
@coke - Status changed from 'new' to 'open' |
From @diakopterOn Thu Oct 20 17:46:28 2011, coke wrote:
Now outputs: 14:40 < diakopter> rakudo: class A { has $c where 1; } |
From @usev6All of the above parses now (on Moar, Parrot and JVM): $ perl6 -e 'class A { has ($.x where 1) }; say "alive"' $ perl6 -e 'class A { has $.x where 1 }; say "alive"' $ perl6-m -e 'class A { has $x where 1; }; say "alive"' $ perl6 -e 'class A { has Int $.color where 1|2; }; say "alive"' STD also agrees: $ viv -c -e 'class A { has Int $.color where 1|2; }' But before adding tests I wonder whether the where clause has any effect. Shouldn't the following complain that $.color is restricted to values 1 and 2? $ perl6 -e 'class A { has Int $.color where 1|2 }; my $a = A.new( color => 3 ); say $a;' |
1 similar comment
From @usev6All of the above parses now (on Moar, Parrot and JVM): $ perl6 -e 'class A { has ($.x where 1) }; say "alive"' $ perl6 -e 'class A { has $.x where 1 }; say "alive"' $ perl6-m -e 'class A { has $x where 1; }; say "alive"' $ perl6 -e 'class A { has Int $.color where 1|2; }; say "alive"' STD also agrees: $ viv -c -e 'class A { has Int $.color where 1|2; }' But before adding tests I wonder whether the where clause has any effect. Shouldn't the following complain that $.color is restricted to values 1 and 2? $ perl6 -e 'class A { has Int $.color where 1|2 }; my $a = A.new( color => 3 ); say $a;' |
From @usev6On Thu Oct 16 02:51:19 2014, bartolin@gmx.de wrote:
I found ticket 122109 (https://rt-archive.perl.org/perl6/Ticket/Display.html?id=122109) which is a about where clauses on attributes NYI. So I added a test for this ticket to S12-class/attributes.t with the following commit: Raku/roast@cc6dfe8bd8. I'm closing this ticket now. |
1 similar comment
From @usev6On Thu Oct 16 02:51:19 2014, bartolin@gmx.de wrote:
I found ticket 122109 (https://rt-archive.perl.org/perl6/Ticket/Display.html?id=122109) which is a about where clauses on attributes NYI. So I added a test for this ticket to S12-class/attributes.t with the following commit: Raku/roast@cc6dfe8bd8. I'm closing this ticket now. |
@usev6 - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#75858 (status was 'resolved')
Searchable as RT75858$
The text was updated successfully, but these errors were encountered: