Skip to content

Commit 600f466

Browse files
committed
Autocorrect and replace Module#=== with Primitive.object_kind_of?
1 parent 5d89db6 commit 600f466

21 files changed

+43
-43
lines changed

src/main/ruby/truffleruby/core/array.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ def values_at(*args)
13481348

13491349
# Synchronize with Enumerator#zip and Enumerable#zip
13501350
def zip(*others)
1351-
if !block_given? and others.size == 1 and Array === others[0]
1351+
if !block_given? and others.size == 1 and Primitive.object_kind_of?(others[0], Array)
13521352
return Primitive.array_zip self, others[0]
13531353
end
13541354

src/main/ruby/truffleruby/core/dir_glob.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ def self.single_compile(glob, flags = 0)
458458
end
459459

460460
def self.run(node, all_matches, glob_base_dir, flags = 0)
461-
if ConstantEntry === node
461+
if Primitive.object_kind_of?(node, ConstantEntry)
462462
node.process_directory all_matches, nil, nil, glob_base_dir
463463
else
464464
matches = []

src/main/ruby/truffleruby/core/enumerable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def zip(*enums)
376376
def each_with_index(*args, &block)
377377
return to_enum(:each_with_index, *args) { enumerator_size } unless block_given?
378378

379-
if Array === self
379+
if Primitive.object_kind_of?(self, Array)
380380
Primitive.array_each_with_index(self, block)
381381
else
382382
idx = 0

src/main/ruby/truffleruby/core/integer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def chr(enc = undefined)
186186
def round(ndigits = undefined, half: :up)
187187
return self if Primitive.undefined? ndigits
188188

189-
if Float === ndigits && ndigits.infinite?
189+
if Primitive.object_kind_of?(ndigits, Float) && ndigits.infinite?
190190
raise RangeError, "float #{ndigits} out of range of integer"
191191
end
192192

src/main/ruby/truffleruby/core/kernel.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def Integer(obj, base = 0, exception: true)
106106
base = Primitive.nil?(converted_base) ? 0 : converted_base
107107
raise_exception = !exception.equal?(false)
108108

109-
if String === obj
109+
if Primitive.object_kind_of?(obj, String)
110110
Primitive.string_to_inum(obj, base, true, raise_exception)
111111
else
112112
bad_base_check = Proc.new do

src/main/ruby/truffleruby/core/marshal.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ def get_symbol
10641064
@call = true
10651065
end
10661066

1067-
unless Symbol === sym
1067+
unless Primitive.object_kind_of?(sym, Symbol)
10681068
raise ArgumentError, "expected Symbol, got #{sym.inspect}"
10691069
end
10701070

@@ -1303,7 +1303,7 @@ def serialize_user_marshal(obj)
13031303
end
13041304

13051305
def store_unique_object(obj)
1306-
if Symbol === obj
1306+
if Primitive.object_kind_of?(obj, Symbol)
13071307
add_symlink obj
13081308
else
13091309
add_non_immediate_object obj
@@ -1337,7 +1337,7 @@ def construct_object
13371337
else
13381338
obj = klass.allocate
13391339

1340-
raise TypeError, 'dump format error' unless Object === obj
1340+
raise TypeError, 'dump format error' unless Primitive.object_kind_of?(obj, Object)
13411341

13421342
store_unique_object obj
13431343
if Primitive.object_kind_of? obj, Exception

src/main/ruby/truffleruby/core/match_data.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def named_captures
7171
end
7272

7373
def begin(index)
74-
backref = if String === index || Symbol === index
74+
backref = if Primitive.object_kind_of?(index, String) || Primitive.object_kind_of?(index, Symbol)
7575
names_to_backref = Hash[Primitive.regexp_names(self.regexp)]
7676
names_to_backref[index.to_sym].last
7777
else
@@ -83,7 +83,7 @@ def begin(index)
8383
end
8484

8585
def end(index)
86-
backref = if String === index || Symbol === index
86+
backref = if Primitive.object_kind_of?(index, String) || Primitive.object_kind_of?(index, Symbol)
8787
names_to_backref = Hash[Primitive.regexp_names(self.regexp)]
8888
names_to_backref[index.to_sym].last
8989
else

src/main/ruby/truffleruby/core/math.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def ldexp(fraction, exponent)
3737
result = Primitive.math_ldexp(fraction, exponent)
3838
if !Primitive.undefined?(result)
3939
result
40-
elsif Float === exponent and exponent.nan?
40+
elsif Primitive.object_kind_of?(exponent, Float) and exponent.nan?
4141
raise RangeError, 'float NaN out of range of integer'
4242
else
4343
ldexp(

src/main/ruby/truffleruby/core/posix.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def self.attach_function_eagerly(native_name, argument_types, return_type,
140140
if blocking
141141
begin
142142
result = Primitive.thread_run_blocking_nfi_system_call(bound_func, args)
143-
end while Integer === result and result == -1 and Errno.errno == EINTR
143+
end while Primitive.object_kind_of?(result, Integer) and result == -1 and Errno.errno == EINTR
144144
else
145145
result = bound_func.call(*args)
146146
end

src/main/ruby/truffleruby/core/range.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,17 @@ def bsearch(&block)
7171
start = self.begin
7272
stop = self.end
7373

74-
if Float === start || Float === stop
74+
if Primitive.object_kind_of?(start, Float) || Primitive.object_kind_of?(stop, Float)
7575
bsearch_float(&block)
76-
elsif Integer === start
76+
elsif Primitive.object_kind_of?(start, Integer)
7777
if Primitive.nil? stop
7878
bsearch_endless(&block)
79-
elsif Integer === stop
79+
elsif Primitive.object_kind_of?(stop, Integer)
8080
bsearch_integer(&block)
8181
else
8282
raise TypeError, "bsearch is not available for #{stop.class}"
8383
end
84-
elsif Primitive.nil?(start) && Integer === stop
84+
elsif Primitive.nil?(start) && Primitive.object_kind_of?(stop, Integer)
8585
bsearch_beginless(&block)
8686
else
8787
raise TypeError, "bsearch is not available for #{start.class}"
@@ -317,7 +317,7 @@ def count(item = undefined)
317317
end
318318

319319
private def each_endless(first, &block)
320-
if Integer === first
320+
if Primitive.object_kind_of?(first, Integer)
321321
i = first
322322
while true
323323
yield i
@@ -481,7 +481,7 @@ def %(n)
481481
end
482482

483483
private def step_endless(first, step_size, &block)
484-
if Numeric === first
484+
if Primitive.object_kind_of?(first, Numeric)
485485
curr = first
486486
while true
487487
yield curr

0 commit comments

Comments
 (0)