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

invalid arguments to .subst/.subst-mutate silently ignored #5699

Closed
p6rt opened this issue Sep 27, 2016 · 3 comments
Closed

invalid arguments to .subst/.subst-mutate silently ignored #5699

p6rt opened this issue Sep 27, 2016 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 27, 2016

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

Searchable as RT129374$

@p6rt
Copy link
Author

p6rt commented Sep 27, 2016

From @zoffixznet

# I have the fix; filing for records

The .subst/.subst-mutate methods slurp several of their options into a hash and then pass those
along to Str.match call. The logic that handles the result of that call, however, does not
pay attention to Failures. Specifically, failures resulting from incorrect values provided for
the named arguments that get passed to .match​:

m​: say 'foo'.subst​: /\w/, '', :x{2}
rakudo-moar 222d16​: OUTPUT«foo␤»
m​: say 'foo'.subst​: /\w/, '', :th(2.5)
rakudo-moar 222d16​: OUTPUT«foo␤»
m​: say ($ = 'foo').subst-mutate​: /\w/, '', :th(2.5)
rakudo-moar 222d16​: OUTPUT«Nil␤»

Thus, the user never receives any indication they're using the wrong arguments and the code behaves as the match simply fails.

@p6rt
Copy link
Author

p6rt commented Sep 27, 2016

From @zoffixznet

Fixed in rakudo/rakudo@6ef4cdf543
Tests added in Raku/roast@925cf4bd8b

On Tue Sep 27 11​:39​:00 2016, cpan@​zoffix.com wrote​:

# I have the fix; filing for records

The .subst/.subst-mutate methods slurp several of their options into a
hash and then pass those
along to Str.match call. The logic that handles the result of that
call, however, does not
pay attention to Failures. Specifically, failures resulting from
incorrect values provided for
the named arguments that get passed to .match​:

m​: say 'foo'.subst​: /\w/, '', :x{2}
rakudo-moar 222d16​: OUTPUT«foo␤»
m​: say 'foo'.subst​: /\w/, '', :th(2.5)
rakudo-moar 222d16​: OUTPUT«foo␤»
m​: say ($ = 'foo').subst-mutate​: /\w/, '', :th(2.5)
rakudo-moar 222d16​: OUTPUT«Nil␤»

Thus, the user never receives any indication they're using the wrong
arguments and the code behaves as the match simply fails.

@p6rt
Copy link
Author

p6rt commented Sep 27, 2016

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

@p6rt p6rt closed this as completed Sep 27, 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
Development

No branches or pull requests

1 participant