Created
February 6, 2016 17:12
-
-
Save lizmat/fc376b2b5cb16619ab2b to your computer and use it in GitHub Desktop.
fails initializing objects with native nums iff Test.pm is loaded
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/Mu.pm b/src/core/Mu.pm | |
index d34ae40..8beed17 100644 | |
--- a/src/core/Mu.pm | |
+++ b/src/core/Mu.pm | |
@@ -112,6 +112,7 @@ Please refactor this code using the new Iterator / Seq interface. | |
} | |
method BUILDALL(@autovivs, %attrinit) { | |
+ my $init := nqp::getattr(%attrinit,Map,'$!storage'); | |
# Get the build plan. Note that we do this "low level" to | |
# avoid the NQP type getting mapped to a Rakudo one, which | |
# would get expensive. | |
@@ -127,26 +128,22 @@ Please refactor this code using the new Iterator / Seq interface. | |
nqp::atpos($task, 1)(self, |%attrinit); | |
} | |
elsif nqp::iseq_i($code, 1) { | |
- # See if we have a value to initialize this attr | |
- # with. | |
- my $key_name := nqp::p6box_s(nqp::atpos($task, 2)); | |
+ # See if we have a value to initialize this attr with. | |
nqp::getattr(self,nqp::atpos($task,1),nqp::atpos($task,3)) | |
- = %attrinit.AT-KEY($key_name) | |
- if %attrinit.EXISTS-KEY($key_name); | |
+ = %attrinit.AT-KEY(nqp::p6box_s(nqp::atpos($task,2))) | |
+ if nqp::existskey($init,nqp::atpos($task,2)); | |
} | |
elsif nqp::iseq_i($code, 2) { | |
- my $key_name := nqp::p6box_s(nqp::atpos($task, 2)); | |
- %attrinit.EXISTS-KEY($key_name) | |
+ nqp::existskey($init,nqp::atpos($task,2)) | |
?? (nqp::getattr(self,nqp::atpos($task,1),nqp::atpos($task,3)) | |
- = %attrinit.AT-KEY($key_name)) | |
+ = %attrinit.AT-KEY(nqp::p6box_s(nqp::atpos($task,2)))) | |
!! nqp::bindattr(self,nqp::atpos($task,1),nqp::atpos($task,3), | |
nqp::list); | |
} | |
elsif nqp::iseq_i($code, 3) { | |
- my $key_name := nqp::p6box_s(nqp::atpos($task, 2)); | |
- %attrinit.EXISTS-KEY($key_name) | |
+ nqp::existskey($init,nqp::atpos($task,2)) | |
?? (nqp::getattr(self,nqp::atpos($task,1),nqp::atpos($task,3)) | |
- = %attrinit.AT-KEY($key_name)) | |
+ = %attrinit.AT-KEY(nqp::p6box_s(nqp::atpos($task,2)))) | |
!! nqp::bindattr(self,nqp::atpos($task,1),nqp::atpos($task,3), | |
nqp::hash); | |
} | |
@@ -157,22 +154,19 @@ Please refactor this code using the new Iterator / Seq interface. | |
} | |
} | |
elsif nqp::iseq_i($code, 5) { | |
- my $key_name := nqp::p6box_s(nqp::atpos($task, 2)); | |
nqp::bindattr_i(self,nqp::atpos($task,1),nqp::atpos($task,3), | |
- nqp::decont(%attrinit.AT-KEY($key_name))) | |
- if %attrinit.EXISTS-KEY($key_name); | |
+ nqp::decont(%attrinit.AT-KEY(nqp::p6box_s(nqp::atpos($task,2))))) | |
+ if nqp::existskey($init,nqp::atpos($task,2)); | |
} | |
elsif nqp::iseq_i($code, 6) { | |
- my $key_name := nqp::p6box_s(nqp::atpos($task, 2)); | |
nqp::bindattr_n(self,nqp::atpos($task,1),nqp::atpos($task,3), | |
- nqp::decont(%attrinit.AT-KEY($key_name))) | |
- if %attrinit.EXISTS-KEY($key_name); | |
+ nqp::decont(%attrinit.AT-KEY(nqp::p6box_s(nqp::atpos($task,2))))) | |
+ if nqp::existskey($init,nqp::atpos($task,2)); | |
} | |
elsif nqp::iseq_i($code, 7) { | |
- my $key_name := nqp::p6box_s(nqp::atpos($task, 2)); | |
nqp::bindattr_s(self,nqp::atpos($task,1),nqp::atpos($task,3), | |
- nqp::decont(%attrinit.AT-KEY($key_name))) | |
- if %attrinit.EXISTS-KEY($key_name); | |
+ nqp::decont(%attrinit.AT-KEY(nqp::p6box_s(nqp::atpos($task,2))))) | |
+ if nqp::existskey($init,nqp::atpos($task,2)); | |
} | |
elsif nqp::iseq_i($code, 8) { | |
my int $cur_value = nqp::getattr_i(self, nqp::atpos($task, 1), nqp::atpos($task, 2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 6 'class C { has num $.a }; C.new(a => 42e0)' # golfed, is fine | |
$ 6l 'use Test; class C { has num $.a }; C.new(a => 42e0)' | |
P6opaque: invalid kind in attribute bind | |
at gen/moar/m-CORE.setting:964 (/Users/liz/Github/rakudo.moar/install/share/perl6/runtime/./CORE.setting.moarvm::0) | |
from gen/moar/m-CORE.setting:964 (/Users/liz/Github/rakudo.moar/install/share/perl6/runtime/./CORE.setting.moarvm:BUILDALL:85) | |
from gen/moar/m-CORE.setting:952 (/Users/liz/Github/rakudo.moar/install/share/perl6/runtime/./CORE.setting.moarvm:bless:41) | |
from gen/moar/m-CORE.setting:939 (/Users/liz/Github/rakudo.moar/install/share/perl6/runtime/./CORE.setting.moarvm:new:20) | |
from gen/moar/m-CORE.setting:937 (/Users/liz/Github/rakudo.moar/install/share/perl6/runtime/./CORE.setting.moarvm:new:39) | |
from -e:1 (<ephemeral file>:<unit>:31) | |
from -e:1 (<ephemeral file>:<unit-outer>:10) | |
from gen/moar/stage2/NQPHLL.nqp:1304 (/Users/liz/Github/rakudo.moar/install/share/nqp/lib/NQPHLL.moarvm:eval:190) | |
from gen/moar/stage2/NQPHLL.nqp:1394 (/Users/liz/Github/rakudo.moar/install/share/nqp/lib/NQPHLL.moarvm::35) | |
from gen/moar/stage2/NQPHLL.nqp:1391 (/Users/liz/Github/rakudo.moar/install/share/nqp/lib/NQPHLL.moarvm:command_eval:155) | |
from src/Perl6/Compiler.nqp:69 (blib/Perl6/Compiler.moarvm:command_eval:93) | |
from gen/moar/stage2/NQPHLL.nqp:1375 (/Users/liz/Github/rakudo.moar/install/share/nqp/lib/NQPHLL.moarvm:command_line:114) | |
from gen/moar/m-main.nqp:37 (/Users/liz/Github/rakudo.moar/install/share/perl6/runtime/perl6.moarvm:MAIN:18) | |
from gen/moar/m-main.nqp:33 (/Users/liz/Github/rakudo.moar/install/share/perl6/runtime/perl6.moarvm:<mainline>:189) | |
from <unknown>:1 (/Users/liz/Github/rakudo.moar/install/share/perl6/runtime/perl6.moarvm:<main>:8) | |
from <unknown>:1 (/Users/liz/Github/rakudo.moar/install/share/perl6/runtime/perl6.moarvm:<entry>:9) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment