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

Smartmatch against `m//` operator mishandles junctions #6455

Open
p6rt opened this issue Aug 18, 2017 · 6 comments
Open

Smartmatch against `m//` operator mishandles junctions #6455

p6rt opened this issue Aug 18, 2017 · 6 comments
Labels

Comments

@p6rt
Copy link

@p6rt p6rt commented Aug 18, 2017

Migrated from rt.perl.org#131925 (status was 'open')

Searchable as RT131925$

@p6rt
Copy link
Author

@p6rt p6rt commented Aug 18, 2017

From @AlexDaniel

Code​:
say so $*DISTRO.Str|$*KERNEL.Str ~~ /linux/

Result​:
True

Code​:
say so $*DISTRO.Str|$*KERNEL.Str ~~ m/linux/

Result​:
False

I'd expect the result to be identical in both cases.

IRC log​: https://irclog.perlgeek.de/perl6-dev/2017-08-18#i_15039736

@p6rt
Copy link
Author

@p6rt p6rt commented Aug 19, 2017

From @smls

The problem only appears if `m//` is used directly as the RHS of `~~`​:

  $_ = 'a' | 'b';
  say m/a/; # any(ï½¢aï½£, Nil)
  say $_ ~~ m/a/; # False
  say $_ ~~ { m/a/ }; # any(ï½¢aï½£, Nil)

@p6rt
Copy link
Author

@p6rt p6rt commented Aug 19, 2017

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

@p6rt
Copy link
Author

@p6rt p6rt commented Aug 19, 2017

From @smls

<smls> bisectable6​: say <a b>.any ~~ m/a/;
<bisectable6> smls, On both starting points (old=2015.12 new=e3e29c5)
  the exit code is 0 and the output is identical as well
<bisectable6> smls, Output on both points​: «False»

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 15, 2017

From @zoffixznet

On Fri, 18 Aug 2017 13​:26​:25 -0700, alex.jakimenko@​gmail.com wrote​:

Code​:
say so $*DISTRO.Str|$*KERNEL.Str ~~ /linux/

Result​:
True

Code​:
say so $*DISTRO.Str|$*KERNEL.Str ~~ m/linux/

Result​:
False

I'd expect the result to be identical in both cases.

IRC log​: https://irclog.perlgeek.de/perl6-dev/2017-08-18#i_15039736

This now[^1] returns True for both cases, so don't understand why and
unsure whether the bug is actually fixed or if that commit just shadowed it.

[1] rakudo/rakudo@8a0f6ac

@p6rt p6rt added Bug regex labels Jan 5, 2020
@jubilatious1
Copy link

@jubilatious1 jubilatious1 commented Mar 30, 2020

I thought this was related to (but maybe not):

Match operator: error with any() junction and user-defined $_ topic variable
rakudo/rakudo#3221

mbook:~ homedir$ perl6
To exit type 'exit' or '^D'
> say so ("dog" | "cat")  ~~ m/dog/;
True
> say $/; say $_;
any(「dog」, (Any))
(Any)
> say so ("dog" | "cat")  ~~ m/cat/;
True
> say $/; say $_;
any((Any), 「cat」)
(Any)
> say so ("dog" | "cat")  ~~ m/linux/;
True
> say $/; say $_;
any((Any), (Any))
(Any)
> say $*VM
moar (2020.02.1)
> exit
mbook:~ homedir$ perl6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.