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

no error about double closure when there are multiple *s in a where clause #5713

Closed
p6rt opened this issue Oct 1, 2016 · 4 comments
Closed

no error about double closure when there are multiple *s in a where clause #5713

p6rt opened this issue Oct 1, 2016 · 4 comments
Labels

Comments

@p6rt
Copy link

@p6rt p6rt commented Oct 1, 2016

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

Searchable as RT129780$

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 1, 2016

From @MasterDuke17

perl6 -e 'sub foo($a where {* < 5}) { dd $a }; foo(3);'
===SORRY!=== Error while compiling -e
Malformed double closure; WhateverCode is already a closure without
curlies, so either remove the curlies or use valid parameter syntax instead
of *
at -e​:1
------> sub foo($a where {* < 5}) { dd $a }; foo(3);
  expecting any of​:
  horizontal whitespace
  statement end
  statement modifier
  statement modifier loop

but

perl6 -e 'sub foo($a where {* < 5 and * > 9}) { dd $a }; foo(3);'
Int $a = 3

There's no error and the (impossible) where clause is ignored.

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 1, 2016

From @MasterDuke17

On Sat Oct 01 07​:02​:34 2016, ddgreen@​gmail.com wrote​:

perl6 -e 'sub foo($a where {* < 5}) { dd $a }; foo(3);'
===SORRY!=== Error while compiling -e
Malformed double closure; WhateverCode is already a closure without
curlies, so either remove the curlies or use valid parameter syntax instead
of *
at -e​:1
------> sub foo($a where {* < 5}) { dd $a }; foo(3);
expecting any of​:
horizontal whitespace
statement end
statement modifier
statement modifier loop

but

perl6 -e 'sub foo($a where {* < 5 and * > 9}) { dd $a }; foo(3);'
Int $a = 3

There's no error and the (impossible) where clause is ignored.

It's not just where there are multiple *s, it seems to be whenever there's more than one expression

perl6 -e 'sub foo($a where {* < 5 or $a > 9}) { dd $a }; foo(6);'
Int $a = 6

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 2, 2016

From @MasterDuke17

Fixed in rakudo/rakudo#893

Tests added in Raku/roast@82115a3

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 2, 2016

@MasterDuke17 - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this Oct 2, 2016
@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