Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

"where" clauses are parsed, but not enforced, in "my" expressions #5571

Closed p6rt closed 6 years ago

p6rt commented 8 years ago

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

Searchable as RT128935$

p6rt commented 8 years ago

From @timo

  gfldex​: m​: dd my ($i, $k where * == 4) = (1,3); dd $i, $k   +camelia​: rakudo-moar ee8a25​: OUTPUT«(1, 3)␤Int $i = 1␤Int $k = 3␤»

Shouldn't allow $k to be bound to any value that doesn't numify to 4, but it does.

Alternatively (or "in the mean time") it should probably complain that it's NYI.

p6rt commented 8 years ago

@coke - Status changed from 'new' to 'open'

p6rt commented 7 years ago

From @zoffixznet

On Sun, 14 Aug 2016 18​:19​:44 -0700, timo wrote​:

gfldex​:   m​: dd my \($i, $k where \* == 4\) = \(1,3\); dd $i, $k
\+camelia​: rakudo\-moar ee8a25​: OUTPUT«\(1, 3\)␤Int $i = 1␤Int $k = 3␤»

Shouldn't allow $k to be bound to any value that doesn't numify to 4, but it does.

Alternatively (or "in the mean time") it should probably complain that it's NYI.

It is implemented and works for single variables. The bug occurs whenever the my is done on several variables.

And I can't get it to dump the parse tree, as it hangs (perhaps related to the bug?)​:

This is the shortest hanging golf I got​:

./perl6 --target=parse -e 'my ($, $)'

p6rt commented 6 years ago

From @zoffixznet

On Sun, 04 Dec 2016 01​:21​:56 -0800, cpan@​zoffix.com wrote​:

On Sun, 14 Aug 2016 18​:19​:44 -0700, timo wrote​:

gfldex​: m​: dd my ($i, $k where * == 4) = (1,3); dd $i, $k +camelia​: rakudo-moar ee8a25​: OUTPUT«(1, 3)␤Int $i = 1␤Int $k = 3␤»

Shouldn't allow $k to be bound to any value that doesn't numify to 4, but it does.

Alternatively (or "in the mean time") it should probably complain that it's NYI.

It is implemented and works for single variables. The bug occurs whenever the my is done on several variables.

And I can't get it to dump the parse tree, as it hangs (perhaps related to the bug?)​:

This is the shortest hanging golf I got​:

./perl6 --target=parse -e 'my ($, $)'

Using fix​: Fix postconstraints in `my (...)` being ignored Using test​: Test postconstraints in `my (...)`

Thank you for the report. This is now fixed in branch `post-release`.

Fix​: https://github.com/rakudo/rakudo/commit/3745eff13a21ad8 Test​: https://github.com/perl6/roast/commit/4ce0fc56db432b52b

p6rt commented 6 years ago

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