Skip to content
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

Doing two S/// with an andthen between them messes up $_ in Rakudo #5208

Closed
p6rt opened this issue Apr 2, 2016 · 7 comments
Closed

Doing two S/// with an andthen between them messes up $_ in Rakudo #5208

p6rt opened this issue Apr 2, 2016 · 7 comments
Labels

Comments

@p6rt
Copy link

@p6rt p6rt commented Apr 2, 2016

Migrated from rt.perl.org#127822 (status was 'resolved')

Searchable as RT127822$

@p6rt
Copy link
Author

@p6rt p6rt commented Apr 2, 2016

From @masak

<TimToady> m​: say (S/Once/Twice/ given "Once upon a time")
<camelia> rakudo-moar a87fb4​: OUTPUT«Twice upon a time␤»
<TimToady> m​: say (S/Once/Twice/ andthen S/a/two/ given "Once upon a time")
<camelia> rakudo-moar a87fb4​: OUTPUT«atwo␤»

(Expected value here​: "Twice upon two time".)

<TimToady> a rather peculiar bug
* masak submits rakudobug
<masak> m​: $_ = "Once upon a time"; say (S/Once/Twice/ andthen S/a/two/)
<camelia> rakudo-moar a87fb4​: OUTPUT«atwo␤»

(Expected value here​: "Twice upon two time".)

<masak> m​: $_ = "Once upon a time"; say ($_ ~= ", kthx" andthen S/a/two/)
<camelia> rakudo-moar a87fb4​: OUTPUT«Once upon two time, kthx␤»

(This one is fine.)

<masak> ok, so both S/// are needed to trigger the bug
<masak> but not the given

Loading

@p6rt
Copy link
Author

@p6rt p6rt commented Jul 10, 2016

From @zoffixznet

Still present in rakudo 405519​:

<Zoffix> m​: say (S/a/A/ andthen S/b/B/ given "ab")
<camelia> rakudo-moar 405519​: OUTPUT«bB␤»

Loading

@p6rt
Copy link
Author

@p6rt p6rt commented Jul 20, 2016

From @zoffixznet


🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁

TODO-fudged tests added in Raku/roast@72789d0

🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁

--
Cheers,
ZZ | https://twitter.com/zoffix

Loading

@p6rt
Copy link
Author

@p6rt p6rt commented Jul 20, 2016

The RT System itself - Status changed from 'new' to 'open'

Loading

@p6rt
Copy link
Author

@p6rt p6rt commented Dec 19, 2016

From @zoffixznet

Digging into it, seems the cause is the `is raw` on the thunk in `andthen`, which is the `$/` of the previous S///

So the glitch is due to it overwriting the string while matching it? Or something along those lines?

<Zoffix> m​: $_ = "aaabbb"; dd -> $_ { S/b/B/ }( $/ = $_ );
<camelia> rakudo-moar b8f10c​: OUTPUT«Str $/ = "aaaBbb"␤»
<Zoffix> m​: $_ = "aaabbb"; dd -> $_ is raw { S/b/B/ }( $_ );
<camelia> rakudo-moar b8f10c​: OUTPUT«Str $/ = "aaaBbb"␤»

<Zoffix> m​: $_ = "aaabbb"; dd -> $_ is raw { S/b/B/ }( $/ = $_ );
<camelia> rakudo-moar b8f10c​: OUTPUT«Str $/ = "bB"␤»
<Zoffix> m​: $_ = "aaabbb"; dd -> $_ is raw { S/b/B/ }( $/ = $_ );
<camelia> rakudo-moar b8f10c​: OUTPUT«Str $/ = "bB"␤»

Loading

@p6rt
Copy link
Author

@p6rt p6rt commented Feb 1, 2017

From @zoffixznet

Thank you for the report. This is now fixed.

Fix​: rakudo/rakudo@97359ae
Test unfudged in​: Raku/roast@b15e0a0

Loading

@p6rt
Copy link
Author

@p6rt p6rt commented Feb 1, 2017

@zoffixznet - Status changed from 'open' to 'resolved'

Loading

@p6rt p6rt closed this Feb 1, 2017
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant