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

Issue with one and none Junctions when passed as parameter #6667

Closed
p6rt opened this issue Jan 29, 2018 · 4 comments
Closed

Issue with one and none Junctions when passed as parameter #6667

p6rt opened this issue Jan 29, 2018 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Jan 29, 2018

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

Searchable as RT132780$

@p6rt
Copy link
Author

p6rt commented Jan 29, 2018

From shinobi.cl@gmail.com

I need the junction to be applied inside the regex, not at time of
parameter binding, so i use the type Mu.

`

my Regex @​rxs = (rx/3/, rx/2/); my @​L = (1 .. 23); sub search(Mu $r where
Regex) { grep $r, :v, @​L }; say search( any(@​rxs) );
(2 3 12 13 20 21 22 23)

my Regex @​rxs = (rx/3/, rx/2/); my @​L = (1 .. 23); sub search(Mu $r where
Regex) { grep $r, :v, @​L }; say search( all(@​rxs) );
(23)

my Regex @​rxs = (rx/3/, rx/2/); my @​L = (1 .. 23); sub search(Mu $r where
Regex) { grep $r, :v, @​L }; say search( one(@​rxs) );
Constraint type check failed in binding to parameter '$r'; expected
anonymous constraint to be met but got Junction (one(rx/3/, rx/2/))
  in sub search at <unknown file> line 1
  in block <unit> at <unknown file> line 1

my Regex @​rxs = (rx/3/, rx/2/); my @​L = (1 .. 23); sub search(Mu $r where
Regex) { grep $r, :v, @​L }; say search( none(@​rxs) );
Died with X​::TypeCheck​::Binding​::Parameter
  in sub search at <unknown file> line 1
  in block <unit> at <unknown file> line 1

`

Now, removing Mu, just because :). When used with none, a strange warning
message appears

my Regex @​rxs = (rx/3/, rx/2/); my @​L = (1 .. 23); sub search($r where
Regex) { grep $r, :v, @​L }; say search( any(@​rxs) );
(3 13 23)
(2 12 20 21 22 23)
my Regex @​rxs = (rx/3/, rx/2/); my @​L = (1 .. 23); sub search($r where
Regex) { grep $r, :v, @​L }; say search( all(@​rxs) );
(3 13 23)
(2 12 20 21 22 23)
my Regex @​rxs = (rx/3/, rx/2/); my @​L = (1 .. 23); sub search($r where
Regex) { grep $r, :v, @​L }; say search( one(@​rxs) );
(3 13 23)
(2 12 20 21 22 23)
my Regex @​rxs = (rx/3/, rx/2/); my @​L = (1 .. 23); sub search($r where
Regex) { grep $r, :v, @​L }; say search( none(@​rxs) );
(3 13 23)
(2 12 20 21 22 23)
No such method 'handled' for invocant of type 'Bool'

--
-shinobi.cl-

@p6rt
Copy link
Author

p6rt commented Jan 30, 2018

From @zoffixznet

Thank you for the report.

On Sun, 28 Jan 2018 21​:40​:35 -0800, shinobi.cl@​gmail.com wrote​:

I need the junction to be applied inside the regex, not at time of
parameter binding, so i use the type Mu.

This part I explained last night on IRC​:
https://irclog.perlgeek.de/perl6/2018-01-29#i_15750058

It works as expected, with Junction type affecting the `where` check. You
can achieve what you want by threading through a block inside a where​:
https://irclog.perlgeek.de/perl6/2018-01-29#i_15750022

Now, removing Mu, just because :). When used with none, a strange warning
message appears

my Regex @​rxs = (rx/3/, rx/2/); my @​L = (1 .. 23); sub search($r where
Regex) { grep $r, :v, @​L }; say search( none(@​rxs) );
(3 13 23)
(2 12 20 21 22 23)
No such method 'handled' for invocant of type 'Bool'

This portion was a REPL bug and is now fixed​:

Fix​: rakudo/rakudo@2c36ab2ef94b3f9
Test​: rakudo/rakudo@2c36ab2ef94b3f9

Possibly more of such bugs exist in our codebase. I opened another
ticket for codebase review​: rakudo/rakudo#1456

@p6rt
Copy link
Author

p6rt commented Jan 30, 2018

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

@p6rt p6rt closed this as completed Jan 30, 2018
@p6rt
Copy link
Author

p6rt commented Jan 30, 2018

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

@lizmat lizmat changed the title Issue with one and none Junctins when passed as parameter Issue with one and none Junctions when passed as parameter Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant