Skip to content

Commit fe72d8f

Browse files
committed
mruby-regexp: drop a stray paren from String#split's limit TypeError
The message closed a paren it never opened: no implicit conversion of Float to Integer) CRuby's wording for this case is not adopted along with it. It names the argument rather than what `to_int` returned (`can't convert Object to Integer (Object#to_int gives Float)`), which needs the argument's class, and the only way to read that from mrblib is `Object#class`, redefinable like the `is_a?` this branch has just stopped trusting. Reporting a class the argument chose would be a worse answer than reporting the wrong one of the two real classes, so the message keeps its shape and loses only the paren.
1 parent 99d4dab commit fe72d8f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mrbgems/mruby-regexp/mrblib/string_regexp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def split(pattern = nil, *args)
140140
if limit.respond_to?(:to_int)
141141
limit = limit.to_int
142142
unless Integer === limit
143-
raise TypeError, "no implicit conversion of #{limit.class} to Integer)"
143+
raise TypeError, "no implicit conversion of #{limit.class} to Integer"
144144
end
145145
else
146146
limit = limit.__to_int

0 commit comments

Comments
 (0)