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
Some evaluations return Int instead of Bool due to optimizer's work #5715
Comments
From @usev6We have different tests in roast which are currently failing on JVM $ ./perl6-j -e 'say (0 == 0).HOW' ## S03-operators/basic-types.t |
From @usev6Here are my preliminary findings about this problem. $ ./perl6-j -e 'say (so 1).perl' The optimizer generates a QAST::Want with two children [...] I tried the following patch (skipping the creation of that ==== Inline Patchdiff --git a/src/Perl6/Optimizer.nqp b/src/Perl6/Optimizer.nqp
index 12398ba..dcdd55b 100644
--- a/src/Perl6/Optimizer.nqp
+++ b/src/Perl6/Optimizer.nqp
@@ -1435,7 +1435,7 @@ class Perl6::Optimizer {
my $want;
if !nqp::isconcrete($ret_value) {
# can we create a Want with a type object??? XXX
- } elsif nqp::istype($ret_value, $!symbols.find_in_setting("Int")) && !nqp::isbig_I(nqp::decont($ret_value)) {
+ } elsif nqp::istype($ret_value, $!symbols.find_in_setting("Int")) && !nqp::istype($ret_value, $!symbols.find_in_setting("Bool")) && !nqp::isbig_I(nqp::decont($ret_value)) {
$want := QAST::Want.new($wval,
"Ii", QAST::IVal.new(:value(nqp::unbox_i($ret_value))));
} elsif nqp::istype($ret_value, $!symbols.find_in_setting("Num")) {
With that patch the evaluation gave: $ ./perl6-j -e 'say (so 1).perl' The generated QAST from the optimizer didn't had the Want [...] In src/Perl6/Optimizer.nqp there is an comment that made me think We also generate those QAST::Want for Bool or Mixins like here: $ ./perl6-j -e 'my $value = 42 but False; say ?$value' [...] I asked about my patch on #perl6-dev. There was no clear result, ==== start of discussion on IRC -- cmp. http://irclog.perlgeek.de/perl6-dev/2016-10-02#i_13323463 |
1 similar comment
From @usev6Here are my preliminary findings about this problem. $ ./perl6-j -e 'say (so 1).perl' The optimizer generates a QAST::Want with two children [...] I tried the following patch (skipping the creation of that ==== Inline Patchdiff --git a/src/Perl6/Optimizer.nqp b/src/Perl6/Optimizer.nqp
index 12398ba..dcdd55b 100644
--- a/src/Perl6/Optimizer.nqp
+++ b/src/Perl6/Optimizer.nqp
@@ -1435,7 +1435,7 @@ class Perl6::Optimizer {
my $want;
if !nqp::isconcrete($ret_value) {
# can we create a Want with a type object??? XXX
- } elsif nqp::istype($ret_value, $!symbols.find_in_setting("Int")) && !nqp::isbig_I(nqp::decont($ret_value)) {
+ } elsif nqp::istype($ret_value, $!symbols.find_in_setting("Int")) && !nqp::istype($ret_value, $!symbols.find_in_setting("Bool")) && !nqp::isbig_I(nqp::decont($ret_value)) {
$want := QAST::Want.new($wval,
"Ii", QAST::IVal.new(:value(nqp::unbox_i($ret_value))));
} elsif nqp::istype($ret_value, $!symbols.find_in_setting("Num")) {
With that patch the evaluation gave: $ ./perl6-j -e 'say (so 1).perl' The generated QAST from the optimizer didn't had the Want [...] In src/Perl6/Optimizer.nqp there is an comment that made me think We also generate those QAST::Want for Bool or Mixins like here: $ ./perl6-j -e 'my $value = 42 but False; say ?$value' [...] I asked about my patch on #perl6-dev. There was no clear result, ==== start of discussion on IRC -- cmp. http://irclog.perlgeek.de/perl6-dev/2016-10-02#i_13323463 |
@usev6 - Status changed from 'new' to 'open' |
From @usev6I think I found a clean way to fix the problem: Raku/nqp#309 |
1 similar comment
From @usev6I think I found a clean way to fix the problem: Raku/nqp#309 |
From @usev6Fixed with Raku/nqp@5769a65fbc and Raku/nqp@2d88d98201 I'm closing this ticket as 'resolved'. |
1 similar comment
From @usev6Fixed with Raku/nqp@5769a65fbc and Raku/nqp@2d88d98201 I'm closing this ticket as 'resolved'. |
@usev6 - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#129782 (status was 'resolved')
Searchable as RT129782$
The text was updated successfully, but these errors were encountered: