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
Pairs constructor :pair and :!pair do not work properly in Rakudo #865
Comments
From @ilyabelikinHo there, Pairs constructor changed: S02, L2538 Fat arrow Adverbial pair Paren form but in Rakudo, now:
I hope this one easy to fix. Thank you! Ilya |
@ilyabelikin - Status changed from 'new' to 'open' |
From @ilyabelikinArgh, gmail eat one. 2009/4/7 �� <forihrd@gmail.com>:
|
From @ilyabelikinYet Another Approach |
From @ilyabelikinpatch.diffdiff --git a/src/parser/actions.pm b/src/parser/actions.pm
index 6939aac..c198252 100644
--- a/src/parser/actions.pm
+++ b/src/parser/actions.pm
@@ -2880,7 +2880,7 @@ method colonpair($/, $key) {
if $key eq 'false' {
$pair_key := PAST::Val.new( :value(~$<identifier>) );
- $pair_val := PAST::Val.new( :value(0), :returns('Int') );
+ $pair_val := PAST::Var.new( :name('False'), :namespace('Bool'), :scope('package') );
}
elsif $key eq 'value' {
$pair_key := PAST::Val.new( :value(~$<identifier>) );
@@ -2891,7 +2891,7 @@ method colonpair($/, $key) {
}
}
else {
- $pair_val := PAST::Val.new( :value(1), :returns('Int') );
+ $pair_val := PAST::Var.new( :name('True'), :namespace('Bool'), :scope('package') );
}
}
elsif $key eq 'varname' {
|
From @ilyabelikinHi there, Ilya 2009/4/5 Ilya Belikin <perl6-bugs-followup@perl.org>:
|
From @ilyabelikincolonpair-tests.diffIndex: S02-builtin_data_types/pair.t
===================================================================
--- S02-builtin_data_types/pair.t (revision 26099)
+++ S02-builtin_data_types/pair.t (working copy)
@@ -2,7 +2,7 @@
use Test;
-plan 99;
+plan 106;
# basic Pair
@@ -89,6 +89,16 @@
ok (%($pair) ~~ Hash), '%() makes creates a real Hash';
}
+# colonpair
+
+is(:foo.key, 'foo', 'got the right key :foo.key');
+isa_ok(:foo.value, Bool::True, ':foo.value isa Bool::True');
+ok( :foo, ':foo is True');
+ok( :foo.value, ':foo.value is True');
+is(:!foo.key, 'foo', 'got the right key :!foo.key');
+isa_ok(:!foo.value, Bool::False, ':!foo.value isa Bool::False');
+nok( :!foo.value, ':!foo.value is False');
+
# illustrate a bug
{
|
From @moritzThanks, I've added the tests to the test suite (fudged for now). I can't Cheers, |
From @ilyabelikinIRC log, pmichaud answering why my patch is wrong: pmichaud: it's something like this: .value on a Pair is an lvalue |
From @moritzThis has been fixed long since, closing ticket... |
@moritz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#64478 (status was 'resolved')
Searchable as RT64478$
The text was updated successfully, but these errors were encountered: