Skip to content

Instantly share code, notes, and snippets.

@ugexe
Last active August 22, 2017 16:10
Show Gist options
  • Save ugexe/31e22b5924319f502f62970fca34e3a0 to your computer and use it in GitHub Desktop.
Save ugexe/31e22b5924319f502f62970fca34e3a0 to your computer and use it in GitHub Desktop.
Why are these changes not equivalent?
$ git diff
diff --git a/src/QRegex/Cursor.nqp b/src/QRegex/Cursor.nqp
index b10804c9f..767d79f3c 100644
--- a/src/QRegex/Cursor.nqp
+++ b/src/QRegex/Cursor.nqp
@@ -87,11 +87,11 @@ role NQPMatchRole is export {
method to() { $!to < 0 ?? $!pos !! $!to }
method CURSOR() { self }
method PRECURSOR() { self."!cursor_init"(nqp::getattr($!shared, ParseShared, '$!target'), :p($!from)) }
- method Str() { $!pos >= $!from ?? nqp::substr(nqp::getattr($!shared, ParseShared, '$!target'), $!from, nqp::sub_i(self.to, $!from)) !! '' }
+ method Str() { $!pos >= $!from ?? nqp::substr(nqp::getattr($!shared, ParseShared, '$!target'), $!from, (($!to < 0 ?? $!pos !! $!to) - $!from)) !! '' }
method Int() { my int $i := +self.Str(); $i } # XXX need a better way to do this
method Num() { +self.Str() }
method Bool() { $!pos >= $!from }
- method chars() { $!pos >= $!from ?? nqp::sub_i(self.to, $!from) !! 0 }
+ method chars() { $!pos >= $!from ?? (($!to < 0 ?? $!pos !! $!to) - $!from) !! 0 }
method make($made) { $!made := $made }
method made() { $!made }
@ugexe
Copy link
Author

ugexe commented Aug 22, 2017

Test Summary Report
-------------------
t/spec/S05-transliteration/79778.t                              (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 1 tests but ran 0.
t/spec/S05-transliteration/with-closure.rakudo.moar             (Wstat: 65280 Tests: 12 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 18 tests but ran 12.
t/spec/S05-transliteration/trans.rakudo.moar                    (Wstat: 65280 Tests: 40 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 65 tests but ran 40.
Files=733, Tests=45879, 394 wallclock secs ( 7.83 usr  2.68 sys + 1006.36 cusr 99.62 csys = 1116.49 CPU)
Result: FAIL

...but does begin passing tests for Grammar::HTTP

@ugexe
Copy link
Author

ugexe commented Aug 22, 2017

$ install/bin/perl6 --ll-exception t/spec/S05-transliteration/79778.t
1..1
This type cannot unbox to a native integer: P6opaque, Num
   at SETTING::src/core/Str.pm:2378  (/Users/ugexe/repos/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:increment_index)
 from SETTING::src/core/Str.pm:2478  (/Users/ugexe/repos/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:next_substitution)
 from SETTING::src/core/Str.pm:2490  (/Users/ugexe/repos/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:result)
 from SETTING::src/core/Str.pm:2609  (/Users/ugexe/repos/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:trans)
 from SETTING::src/core/Str.pm:2256  (/Users/ugexe/repos/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:trans)
 from SETTING::src/core/Str.pm:2262  (/Users/ugexe/repos/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:trans)
 from SETTING::src/core/Str.pm:2256  (/Users/ugexe/repos/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:trans)
 from t/spec/S05-transliteration/79778.t:6  (<ephemeral file>:<unit>)
 from t/spec/S05-transliteration/79778.t:1  (<ephemeral file>:<unit-outer>)
 from gen/moar/stage2/NQPHLL.nqp:1608  (/Users/ugexe/repos/rakudo/install/share/nqp/lib/NQPHLL.moarvm:eval)
 from gen/moar/stage2/NQPHLL.nqp:1830  (/Users/ugexe/repos/rakudo/install/share/nqp/lib/NQPHLL.moarvm:evalfiles)
 from gen/moar/stage2/NQPHLL.nqp:1755  (/Users/ugexe/repos/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_eval)
 from src/Perl6/Compiler.nqp:42  (/Users/ugexe/repos/rakudo/install/share/nqp/lib/Perl6/Compiler.moarvm:command_eval)
 from gen/moar/stage2/NQPHLL.nqp:1696  (/Users/ugexe/repos/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_line)
 from gen/moar/main.nqp:47  (/Users/ugexe/repos/rakudo/install/share/perl6/runtime/perl6.moarvm:MAIN)
 from gen/moar/main.nqp:38  (/Users/ugexe/repos/rakudo/install/share/perl6/runtime/perl6.moarvm:<mainline>)
 from <unknown>:1  (/Users/ugexe/repos/rakudo/install/share/perl6/runtime/perl6.moarvm:<main>)
 from <unknown>:1  (/Users/ugexe/repos/rakudo/install/share/perl6/runtime/perl6.moarvm:<entry>)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment