Skip to content

Commit

Permalink
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 0 additions & 5 deletions spec/truffle/tags/core/string/modulo_tags.txt
Original file line number Diff line number Diff line change
@@ -11,10 +11,6 @@ fails:String#% ignores negative precision
fails:String#% allows a star to take an argument number to use as the width
fails:String#% calls to_int on width star and precision star tokens
fails:String#% does not call #to_a to convert the argument
fails:String#% calls #to_ary to convert the argument
fails:String#% wraps the object in an Array if #to_ary returns nil
fails:String#% raises a TypeError if #to_ary does not return an Array
fails:String#% tries to convert the argument to Array by calling #to_ary
fails:String#% doesn't return subclass instances when called on a subclass
fails:String#% always taints the result when the format string is tainted
fails:String#% supports character formats using %c
@@ -46,7 +42,6 @@ fails:String#% supports hex formats using %x for positive numbers
fails:String#% supports hex formats using %x for negative numbers
fails:String#% supports hex formats using %X for positive numbers
fails:String#% supports hex formats using %X for negative numbers
fails:String#% tries to convert the passed argument to an Array using #to_ary
fails:String#% behaves as if calling Kernel#Float for %e arguments, when the passed argument does not respond to #to_ary
fails:String#% behaves as if calling Kernel#Float for %e arguments, when the passed argument is hexadecimal string
fails:String#% behaves as if calling Kernel#Float for %E arguments, when the passed argument does not respond to #to_ary
7 changes: 6 additions & 1 deletion truffle/src/main/ruby/core/string.rb
Original file line number Diff line number Diff line change
@@ -1641,7 +1641,12 @@ def %(args)
if args.is_a? Hash
sprintf(self, args)
else
sprintf(self, *args)
result = Rubinius::Type.check_convert_type args, Array, :to_ary
if result.nil?
sprintf(self, *args)

This comment has been minimized.

Copy link
@eregon

eregon Jul 11, 2016

Member

The splat should not be needed since we know it's already not a to_ary.

This comment has been minimized.

Copy link
@bjfish

bjfish Jul 11, 2016

Contributor

@eregon Fixed at 24ad16b

else
sprintf(self, *result)
end
end
end

0 comments on commit 935db34

Please sign in to comment.