Actions
Bug #20681
closedRegular expression warnings are treated as compiler warnings during runtime
Description
I have some code that recieves arbitrary input and parses it as a regexp. To supress potential warnings I'm defining the warn
method. Unfortunately it is not getting called:
def warn(...)
puts "CALLED"
end
source = "/\w**/"
Regexp.new(source)
Running this emits a warning and doesn't print "CALLED":
$ ruby test.rb
test.rb:6: warning: regular expression has redundant nested repeat operator '*': /\/w**\//
I looked a bit at the code and found something which I think is supposed to handle this case but it seems like its not checking against the right thing: https://github.com/ruby/ruby/blob/4dbf386ca248df0f47f31dc28cdeabe8d4477e5b/regparse.c#L2986-L2994
Actions
Like0
Like0Like0