rbs 3.4.4 → 3.5.0.pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +7 -0
  3. data/CHANGELOG.md +0 -26
  4. data/Gemfile +12 -1
  5. data/Gemfile.lock +51 -34
  6. data/README.md +2 -1
  7. data/Rakefile +2 -2
  8. data/core/enumerator.rbs +1 -1
  9. data/core/gc.rbs +272 -150
  10. data/core/integer.rbs +4 -3
  11. data/core/io/wait.rbs +4 -4
  12. data/core/io.rbs +10 -3
  13. data/core/kernel.rbs +8 -7
  14. data/core/module.rbs +17 -4
  15. data/core/range.rbs +2 -2
  16. data/core/regexp.rbs +101 -90
  17. data/core/ruby_vm.rbs +103 -103
  18. data/core/string.rbs +3 -3
  19. data/core/symbol.rbs +2 -1
  20. data/core/thread.rbs +1 -1
  21. data/core/time.rbs +24 -4
  22. data/docs/architecture.md +110 -0
  23. data/docs/syntax.md +5 -1
  24. data/ext/rbs_extension/constants.c +2 -0
  25. data/ext/rbs_extension/constants.h +1 -0
  26. data/ext/rbs_extension/location.c +79 -70
  27. data/ext/rbs_extension/location.h +23 -5
  28. data/ext/rbs_extension/parser.c +82 -24
  29. data/ext/rbs_extension/parserstate.c +4 -0
  30. data/ext/rbs_extension/ruby_objs.c +13 -3
  31. data/ext/rbs_extension/ruby_objs.h +1 -0
  32. data/lib/rbs/collection/config.rb +1 -1
  33. data/lib/rbs/collection/sources/git.rb +1 -6
  34. data/lib/rbs/definition_builder/method_builder.rb +1 -1
  35. data/lib/rbs/definition_builder.rb +8 -8
  36. data/lib/rbs/diff.rb +1 -1
  37. data/lib/rbs/environment_loader.rb +2 -1
  38. data/lib/rbs/errors.rb +0 -14
  39. data/lib/rbs/parser_aux.rb +0 -5
  40. data/lib/rbs/prototype/helpers.rb +22 -12
  41. data/lib/rbs/prototype/rb.rb +38 -4
  42. data/lib/rbs/prototype/rbi.rb +30 -20
  43. data/lib/rbs/test/errors.rb +19 -14
  44. data/lib/rbs/test/tester.rb +1 -1
  45. data/lib/rbs/test/type_check.rb +95 -16
  46. data/lib/rbs/types.rb +112 -13
  47. data/lib/rbs/unit_test/spy.rb +1 -1
  48. data/lib/rbs/version.rb +1 -1
  49. data/rbs.gemspec +1 -1
  50. data/sig/environment_loader.rbs +1 -1
  51. data/sig/errors.rbs +1 -1
  52. data/sig/method_types.rbs +3 -3
  53. data/sig/prototype/helpers.rbs +4 -0
  54. data/sig/prototype/rbi.rbs +2 -0
  55. data/sig/types.rbs +54 -4
  56. data/sig/variance_calculator.rbs +2 -2
  57. data/stdlib/csv/0/csv.rbs +4 -1
  58. data/stdlib/fileutils/0/fileutils.rbs +1 -1
  59. data/stdlib/net-http/0/net-http.rbs +29 -27
  60. data/stdlib/socket/0/socket.rbs +2 -2
  61. data/stdlib/timeout/0/timeout.rbs +6 -0
  62. data/stdlib/uri/0/generic.rbs +2 -2
  63. data/stdlib/uri/0/http.rbs +2 -2
  64. metadata +3 -6
  65. data/lib/rbs/parser_compat/lexer_error.rb +0 -6
  66. data/lib/rbs/parser_compat/located_value.rb +0 -7
  67. data/lib/rbs/parser_compat/semantics_error.rb +0 -6
  68. data/lib/rbs/parser_compat/syntax_error.rb +0 -6
data/core/gc.rbs CHANGED
@@ -7,6 +7,151 @@
7
7
  # You may obtain information about the operation of the GC through GC::Profiler.
8
8
  #
9
9
  module GC
10
+ # <!-- rdoc-file=gc.c -->
11
+ # The GC profiler provides access to information on GC runs including time,
12
+ # length and object space size.
13
+ #
14
+ # Example:
15
+ #
16
+ # GC::Profiler.enable
17
+ #
18
+ # require 'rdoc/rdoc'
19
+ #
20
+ # GC::Profiler.report
21
+ #
22
+ # GC::Profiler.disable
23
+ #
24
+ # See also GC.count, GC.malloc_allocated_size and GC.malloc_allocations
25
+ #
26
+ module Profiler
27
+ # <!--
28
+ # rdoc-file=gc.c
29
+ # - GC::Profiler.clear -> nil
30
+ # -->
31
+ # Clears the GC profiler data.
32
+ #
33
+ def self.clear: () -> nil
34
+
35
+ # <!--
36
+ # rdoc-file=gc.c
37
+ # - GC::Profiler.disable -> nil
38
+ # -->
39
+ # Stops the GC profiler.
40
+ #
41
+ def self.disable: () -> nil
42
+
43
+ # <!--
44
+ # rdoc-file=gc.c
45
+ # - GC::Profiler.enable -> nil
46
+ # -->
47
+ # Starts the GC profiler.
48
+ #
49
+ def self.enable: () -> nil
50
+
51
+ # <!--
52
+ # rdoc-file=gc.c
53
+ # - GC::Profiler.enabled? -> true or false
54
+ # -->
55
+ # The current status of GC profile mode.
56
+ #
57
+ def self.enabled?: () -> bool
58
+
59
+ # <!--
60
+ # rdoc-file=gc.c
61
+ # - GC::Profiler.raw_data -> [Hash, ...]
62
+ # -->
63
+ # Returns an Array of individual raw profile data Hashes ordered from earliest
64
+ # to latest by `:GC_INVOKE_TIME`.
65
+ #
66
+ # For example:
67
+ #
68
+ # [
69
+ # {
70
+ # :GC_TIME=>1.3000000000000858e-05,
71
+ # :GC_INVOKE_TIME=>0.010634999999999999,
72
+ # :HEAP_USE_SIZE=>289640,
73
+ # :HEAP_TOTAL_SIZE=>588960,
74
+ # :HEAP_TOTAL_OBJECTS=>14724,
75
+ # :GC_IS_MARKED=>false
76
+ # },
77
+ # # ...
78
+ # ]
79
+ #
80
+ # The keys mean:
81
+ #
82
+ # `:GC_TIME`
83
+ # : Time elapsed in seconds for this GC run
84
+ # `:GC_INVOKE_TIME`
85
+ # : Time elapsed in seconds from startup to when the GC was invoked
86
+ # `:HEAP_USE_SIZE`
87
+ # : Total bytes of heap used
88
+ # `:HEAP_TOTAL_SIZE`
89
+ # : Total size of heap in bytes
90
+ # `:HEAP_TOTAL_OBJECTS`
91
+ # : Total number of objects
92
+ # `:GC_IS_MARKED`
93
+ # : Returns `true` if the GC is in mark phase
94
+ #
95
+ #
96
+ # If ruby was built with `GC_PROFILE_MORE_DETAIL`, you will also have access to
97
+ # the following hash keys:
98
+ #
99
+ # `:GC_MARK_TIME`
100
+ # `:GC_SWEEP_TIME`
101
+ # `:ALLOCATE_INCREASE`
102
+ # `:ALLOCATE_LIMIT`
103
+ # `:HEAP_USE_PAGES`
104
+ # `:HEAP_LIVE_OBJECTS`
105
+ # `:HEAP_FREE_OBJECTS`
106
+ # `:HAVE_FINALIZE`
107
+ # :
108
+ #
109
+ def self.raw_data: () -> Array[Hash[Symbol, untyped]]
110
+
111
+ # <!--
112
+ # rdoc-file=gc.c
113
+ # - GC::Profiler.report
114
+ # - GC::Profiler.report(io)
115
+ # -->
116
+ # Writes the GC::Profiler.result to `$stdout` or the given IO object.
117
+ #
118
+ def self.report: (?_Reporter io) -> nil
119
+
120
+ interface _Reporter
121
+ def write: (String msg) -> void
122
+ end
123
+
124
+ # <!--
125
+ # rdoc-file=gc.c
126
+ # - GC::Profiler.result -> String
127
+ # -->
128
+ # Returns a profile data report such as:
129
+ #
130
+ # GC 1 invokes.
131
+ # Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC time(ms)
132
+ # 1 0.012 159240 212940 10647 0.00000000000001530000
133
+ #
134
+ def self.result: () -> String
135
+
136
+ # <!--
137
+ # rdoc-file=gc.c
138
+ # - GC::Profiler.total_time -> float
139
+ # -->
140
+ # The total time used for garbage collection in seconds
141
+ #
142
+ def self.total_time: () -> Float
143
+ end
144
+
145
+ # <!-- rdoc-file=gc.c -->
146
+ # Internal constants in the garbage collector.
147
+ #
148
+ INTERNAL_CONSTANTS: Hash[Symbol, untyped]
149
+
150
+ # <!-- rdoc-file=gc.c -->
151
+ # GC build options
152
+ #
153
+ OPTS: Array[String]
154
+
10
155
  # <!--
11
156
  # rdoc-file=gc.rb
12
157
  # - GC.count -> Integer
@@ -70,7 +215,7 @@ module GC
70
215
  # are not guaranteed to be future-compatible, and may be ignored if the
71
216
  # underlying implementation does not support them.
72
217
  #
73
- def self.start: (?immediate_sweep: boolish immediate_sweep, ?immediate_mark: boolish immediate_mark, ?full_mark: boolish full_mark) -> nil
218
+ def self.start: (?immediate_sweep: boolish, ?immediate_mark: boolish, ?full_mark: boolish) -> nil
74
219
 
75
220
  # <!--
76
221
  # rdoc-file=gc.rb
@@ -156,8 +301,122 @@ module GC
156
301
  #
157
302
  # This method is only expected to work on CRuby.
158
303
  #
159
- def self.stat: (?::Hash[Symbol, Integer] arg0) -> ::Hash[Symbol, Integer]
160
- | (?Symbol arg0) -> Integer
304
+ def self.stat: (?Hash[Symbol, untyped]? hash) -> Hash[Symbol, untyped]
305
+ | (Symbol key) -> Integer
306
+
307
+ # <!--
308
+ # rdoc-file=gc.rb
309
+ # - GC.measure_total_time = true/false
310
+ # -->
311
+ # Enable to measure GC time. You can get the result with `GC.stat(:time)`. Note
312
+ # that GC time measurement can cause some performance overhead.
313
+ #
314
+ def self.measure_total_time=: [T] (T enable) -> T
315
+
316
+ # <!--
317
+ # rdoc-file=gc.rb
318
+ # - GC.measure_total_time -> true/false
319
+ # -->
320
+ # Return measure_total_time flag (default: `true`). Note that measurement can
321
+ # affect the application performance.
322
+ #
323
+ def self.measure_total_time: () -> bool
324
+
325
+ # <!--
326
+ # rdoc-file=gc.c
327
+ # - GC.auto_compact = flag
328
+ # -->
329
+ # Updates automatic compaction mode.
330
+ #
331
+ # When enabled, the compactor will execute on every major collection.
332
+ #
333
+ # Enabling compaction will degrade performance on major collections.
334
+ #
335
+ def self.auto_compact=: [T] (T enable) -> T
336
+
337
+ # <!--
338
+ # rdoc-file=gc.c
339
+ # - GC.auto_compact -> true or false
340
+ # -->
341
+ # Returns whether or not automatic compaction has been enabled.
342
+ #
343
+ def self.auto_compact: () -> bool
344
+
345
+ # <!--
346
+ # rdoc-file=gc.rb
347
+ # - GC.stat_heap -> Hash
348
+ # - GC.stat_heap(nil, hash) -> Hash
349
+ # - GC.stat_heap(heap_name) -> Hash
350
+ # - GC.stat_heap(heap_name, hash) -> Hash
351
+ # - GC.stat_heap(heap_name, :key) -> Numeric
352
+ # -->
353
+ # Returns information for heaps in the GC.
354
+ #
355
+ # If the first optional argument, `heap_name`, is passed in and not `nil`, it
356
+ # returns a `Hash` containing information about the particular heap. Otherwise,
357
+ # it will return a `Hash` with heap names as keys and a `Hash` containing
358
+ # information about the heap as values.
359
+ #
360
+ # If the second optional argument, `hash_or_key`, is given as `Hash`, it will be
361
+ # overwritten and returned. This is intended to avoid the probe effect.
362
+ #
363
+ # If both optional arguments are passed in and the second optional argument is a
364
+ # symbol, it will return a `Numeric` of the value for the particular heap.
365
+ #
366
+ # On CRuby, `heap_name` is of the type `Integer` but may be of type `String` on
367
+ # other implementations.
368
+ #
369
+ # The contents of the hash are implementation specific and may change in the
370
+ # future without notice.
371
+ #
372
+ # If the optional argument, hash, is given, it is overwritten and returned.
373
+ #
374
+ # This method is only expected to work on CRuby.
375
+ #
376
+ # The hash includes the following keys about the internal information in the GC:
377
+ #
378
+ # slot_size
379
+ # : The slot size of the heap in bytes.
380
+ # heap_allocatable_pages
381
+ # : The number of pages that can be allocated without triggering a new garbage
382
+ # collection cycle.
383
+ # heap_eden_pages
384
+ # : The number of pages in the eden heap.
385
+ # heap_eden_slots
386
+ # : The total number of slots in all of the pages in the eden heap.
387
+ # heap_tomb_pages
388
+ # : The number of pages in the tomb heap. The tomb heap only contains pages
389
+ # that do not have any live objects.
390
+ # heap_tomb_slots
391
+ # : The total number of slots in all of the pages in the tomb heap.
392
+ # total_allocated_pages
393
+ # : The total number of pages that have been allocated in the heap.
394
+ # total_freed_pages
395
+ # : The total number of pages that have been freed and released back to the
396
+ # system in the heap.
397
+ # force_major_gc_count
398
+ # : The number of times major garbage collection cycles this heap has forced
399
+ # to start due to running out of free slots.
400
+ # force_incremental_marking_finish_count
401
+ # : The number of times this heap has forced incremental marking to complete
402
+ # due to running out of pooled slots.
403
+ #
404
+ def self.stat_heap: (?Integer? heap_name, ?Hash[Symbol, untyped]? hash) -> Hash[Symbol, untyped]
405
+ | (Integer heap_name, Symbol key) -> Integer
406
+
407
+ # <!--
408
+ # rdoc-file=gc.c
409
+ # - GC.latest_compact_info -> hash
410
+ # -->
411
+ # Returns information about object moved in the most recent GC compaction.
412
+ #
413
+ # The returned hash has two keys :considered and :moved. The hash for
414
+ # :considered lists the number of objects that were considered for movement by
415
+ # the compactor, and the :moved hash lists the number of objects that were
416
+ # actually moved. Some objects can't be moved (maybe they were pinned) so these
417
+ # numbers can be used to calculate compaction efficiency.
418
+ #
419
+ def self.latest_compact_info: () -> compact_info
161
420
 
162
421
  # <!--
163
422
  # rdoc-file=gc.rb
@@ -165,7 +424,7 @@ module GC
165
424
  # -->
166
425
  # Returns current status of GC stress mode.
167
426
  #
168
- def self.stress: () -> (Integer | TrueClass | FalseClass)
427
+ def self.stress: () -> (Integer | bool)
169
428
 
170
429
  # <!--
171
430
  # rdoc-file=gc.rb
@@ -183,7 +442,8 @@ module GC
183
442
  # 0x02:: no immediate sweep
184
443
  # 0x04:: full mark after malloc/calloc/realloc
185
444
  #
186
- def self.stress=: (Integer | TrueClass | FalseClass flag) -> (Integer | TrueClass | FalseClass)
445
+ def self.stress=: (Integer flag) -> Integer
446
+ | (bool flag) -> bool
187
447
 
188
448
  # <!--
189
449
  # rdoc-file=gc.rb
@@ -210,7 +470,11 @@ module GC
210
470
  #
211
471
  # GC.respond_to?(:compact)
212
472
  #
213
- def self.compact: () -> ::Hash[:considered | :moved, Hash[Symbol | Integer, Integer]]
473
+ def self.compact: () -> compact_info
474
+
475
+ # The type that `GC.compact` and related functions can return.
476
+ #
477
+ type compact_info = Hash[:considered | :moved |:moved_up | :moved_down, Hash[Symbol, Integer]]
214
478
 
215
479
  # <!--
216
480
  # rdoc-file=gc.rb
@@ -227,7 +491,7 @@ module GC
227
491
  # a full GC. If any object contains a reference to a T_MOVED object, that
228
492
  # object should be pushed on the mark stack, and will make a SEGV.
229
493
  #
230
- def self.verify_compaction_references: () -> ::Hash[:considered | :moved, Hash[Symbol | Integer, Integer]]
494
+ def self.verify_compaction_references: (?toward: :empty | untyped, ?double_heap: boolish, ?expand_heap: boolish) -> compact_info
231
495
 
232
496
  # <!--
233
497
  # rdoc-file=gc.c
@@ -251,8 +515,7 @@ module GC
251
515
  # If the optional argument, hash, is given, it is overwritten and returned. This
252
516
  # is intended to avoid probe effect.
253
517
  #
254
- def self.latest_gc_info: () -> ::Hash[::Symbol, untyped]
255
- | [K] (?Hash[K, untyped] hash) -> ::Hash[::Symbol | K, untyped]
518
+ def self.latest_gc_info: (?Hash[Symbol, untyped]? hash) -> Hash[Symbol, untyped]
256
519
  | (Symbol key) -> untyped
257
520
 
258
521
  # <!--
@@ -263,144 +526,3 @@ module GC
263
526
  #
264
527
  def garbage_collect: (?immediate_sweep: boolish immediate_sweep, ?immediate_mark: boolish immediate_mark, ?full_mark: boolish full_mark) -> nil
265
528
  end
266
-
267
- # <!-- rdoc-file=gc.c -->
268
- # Internal constants in the garbage collector.
269
- #
270
- GC::INTERNAL_CONSTANTS: Hash[Symbol, Integer]
271
-
272
- # <!-- rdoc-file=gc.c -->
273
- # GC build options
274
- #
275
- GC::OPTS: Array[String]
276
-
277
- # <!-- rdoc-file=gc.c -->
278
- # The GC profiler provides access to information on GC runs including time,
279
- # length and object space size.
280
- #
281
- # Example:
282
- #
283
- # GC::Profiler.enable
284
- #
285
- # require 'rdoc/rdoc'
286
- #
287
- # GC::Profiler.report
288
- #
289
- # GC::Profiler.disable
290
- #
291
- # See also GC.count, GC.malloc_allocated_size and GC.malloc_allocations
292
- #
293
- module GC::Profiler
294
- # <!--
295
- # rdoc-file=gc.c
296
- # - GC::Profiler.clear -> nil
297
- # -->
298
- # Clears the GC profiler data.
299
- #
300
- def self.clear: () -> void
301
-
302
- # <!--
303
- # rdoc-file=gc.c
304
- # - GC::Profiler.disable -> nil
305
- # -->
306
- # Stops the GC profiler.
307
- #
308
- def self.disable: () -> void
309
-
310
- # <!--
311
- # rdoc-file=gc.c
312
- # - GC::Profiler.enable -> nil
313
- # -->
314
- # Starts the GC profiler.
315
- #
316
- def self.enable: () -> void
317
-
318
- # <!--
319
- # rdoc-file=gc.c
320
- # - GC::Profiler.enabled? -> true or false
321
- # -->
322
- # The current status of GC profile mode.
323
- #
324
- def self.enabled?: () -> bool
325
-
326
- # <!--
327
- # rdoc-file=gc.c
328
- # - GC::Profiler.raw_data -> [Hash, ...]
329
- # -->
330
- # Returns an Array of individual raw profile data Hashes ordered from earliest
331
- # to latest by `:GC_INVOKE_TIME`.
332
- #
333
- # For example:
334
- #
335
- # [
336
- # {
337
- # :GC_TIME=>1.3000000000000858e-05,
338
- # :GC_INVOKE_TIME=>0.010634999999999999,
339
- # :HEAP_USE_SIZE=>289640,
340
- # :HEAP_TOTAL_SIZE=>588960,
341
- # :HEAP_TOTAL_OBJECTS=>14724,
342
- # :GC_IS_MARKED=>false
343
- # },
344
- # # ...
345
- # ]
346
- #
347
- # The keys mean:
348
- #
349
- # `:GC_TIME`
350
- # : Time elapsed in seconds for this GC run
351
- # `:GC_INVOKE_TIME`
352
- # : Time elapsed in seconds from startup to when the GC was invoked
353
- # `:HEAP_USE_SIZE`
354
- # : Total bytes of heap used
355
- # `:HEAP_TOTAL_SIZE`
356
- # : Total size of heap in bytes
357
- # `:HEAP_TOTAL_OBJECTS`
358
- # : Total number of objects
359
- # `:GC_IS_MARKED`
360
- # : Returns `true` if the GC is in mark phase
361
- #
362
- #
363
- # If ruby was built with `GC_PROFILE_MORE_DETAIL`, you will also have access to
364
- # the following hash keys:
365
- #
366
- # `:GC_MARK_TIME`
367
- # `:GC_SWEEP_TIME`
368
- # `:ALLOCATE_INCREASE`
369
- # `:ALLOCATE_LIMIT`
370
- # `:HEAP_USE_PAGES`
371
- # `:HEAP_LIVE_OBJECTS`
372
- # `:HEAP_FREE_OBJECTS`
373
- # `:HAVE_FINALIZE`
374
- # :
375
- #
376
- def self.raw_data: () -> ::Array[::Hash[Symbol, untyped]]
377
-
378
- # <!--
379
- # rdoc-file=gc.c
380
- # - GC::Profiler.report
381
- # - GC::Profiler.report(io)
382
- # -->
383
- # Writes the GC::Profiler.result to `$stdout` or the given IO object.
384
- #
385
- def self.report: (?IO io) -> void
386
-
387
- # <!--
388
- # rdoc-file=gc.c
389
- # - GC::Profiler.result -> String
390
- # -->
391
- # Returns a profile data report such as:
392
- #
393
- # GC 1 invokes.
394
- # Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC time(ms)
395
- # 1 0.012 159240 212940 10647 0.00000000000001530000
396
- #
397
- def self.result: () -> String
398
-
399
- # <!--
400
- # rdoc-file=gc.c
401
- # - GC::Profiler.total_time -> float
402
- # -->
403
- # The total time used for garbage collection in seconds
404
- #
405
- def self.total_time: () -> Float
406
- end
data/core/integer.rbs CHANGED
@@ -1028,9 +1028,10 @@ class Integer < Numeric
1028
1028
  # a.pow(b) #=> same as a**b
1029
1029
  # a.pow(b, m) #=> same as (a**b) % m, but avoids huge temporary values
1030
1030
  #
1031
- def pow: (Integer other, ?Integer modulo) -> Integer
1032
- | (Float) -> Float
1033
- | (Rational) -> Rational
1031
+ def pow: (Integer other) -> (Integer | Rational)
1032
+ | (Integer other, Integer modulo) -> Integer
1033
+ | (Float) -> (Float | Complex)
1034
+ | (Rational) -> (Float | Rational | Complex)
1034
1035
  | (Complex) -> Complex
1035
1036
 
1036
1037
  # <!--
data/core/io/wait.rbs CHANGED
@@ -38,8 +38,8 @@ class IO
38
38
  #
39
39
  # You must require 'io/wait' to use this method.
40
40
  #
41
- def wait: (Integer events, ?Numeric timeout) -> (Integer | false | nil)
42
- | (?Numeric? timeout, *wait_mode mode) -> (self | true | false)
41
+ def wait: (Integer events, ?Time::_Timeout timeout) -> (Integer | false | nil)
42
+ | (?Time::_Timeout? timeout, *wait_mode mode) -> (self | true | false)
43
43
 
44
44
  type wait_mode = :read | :r | :readable | :write | :w | :writable | :read_write | :rw | :readable_writable
45
45
 
@@ -54,7 +54,7 @@ class IO
54
54
  #
55
55
  # You must require 'io/wait' to use this method.
56
56
  #
57
- def wait_readable: (?Numeric? timeout) -> boolish
57
+ def wait_readable: (?Time::_Timeout? timeout) -> boolish
58
58
 
59
59
  # <!--
60
60
  # rdoc-file=ext/io/wait/wait.c
@@ -66,5 +66,5 @@ class IO
66
66
  #
67
67
  # You must require 'io/wait' to use this method.
68
68
  #
69
- def wait_writable: (?Numeric? timeout) -> boolish
69
+ def wait_writable: (?Time::_Timeout? timeout) -> boolish
70
70
  end
data/core/io.rbs CHANGED
@@ -2087,7 +2087,14 @@ class IO < Object
2087
2087
  # -->
2088
2088
  # Get the internal timeout duration or nil if it was not set.
2089
2089
  #
2090
- def timeout: () -> Numeric?
2090
+ def timeout: () -> io_timeout
2091
+
2092
+ # The type used for timeouts in `IO`.
2093
+ #
2094
+ # Technically, this type should be `Time::_Timeout?`. However, in the vast majority of use-cases,
2095
+ # people aren't going to pass their own `_Timeout` in, so `Numeric` is returned for ergonomics
2096
+ # (eg `io.timeout += 10`).
2097
+ type io_timeout = Numeric?
2091
2098
 
2092
2099
  # <!--
2093
2100
  # rdoc-file=io.c
@@ -2110,7 +2117,7 @@ class IO < Object
2110
2117
  # effort to prevent an application from hanging on slow I/O operations, such as
2111
2118
  # those that occur during a slowloris attack.
2112
2119
  #
2113
- def timeout=: (Numeric? duration) -> void
2120
+ def timeout=: (io_timeout duration) -> void
2114
2121
 
2115
2122
  # <!--
2116
2123
  # rdoc-file=io.c
@@ -2945,7 +2952,7 @@ class IO < Object
2945
2952
  # ping
2946
2953
  #
2947
2954
  def self.select: [X, Y, Z] (::Array[X & io]? read_array, ?::Array[Y & io]? write_array, ?::Array[Z & io]? error_array) -> [ Array[X], Array[Y], Array[Z] ]
2948
- | [X, Y, Z] (::Array[X & io]? read_array, ?::Array[Y & io]? write_array, ?::Array[Z & io]? error_array, Numeric? timeout) -> [ Array[X], Array[Y], Array[Z] ]?
2955
+ | [X, Y, Z] (::Array[X & io]? read_array, ?::Array[Y & io]? write_array, ?::Array[Z & io]? error_array, Time::_Timeout? timeout) -> [ Array[X], Array[Y], Array[Z] ]?
2949
2956
 
2950
2957
  # <!--
2951
2958
  # rdoc-file=io.c
data/core/kernel.rbs CHANGED
@@ -1318,10 +1318,10 @@ module Kernel : BasicObject
1318
1318
  #
1319
1319
  # See also Random.rand.
1320
1320
  #
1321
- def self?.rand: () -> Float
1322
- | (Integer arg0) -> Integer
1323
- | (::Range[Integer] arg0) -> Integer
1324
- | (::Range[Float] arg0) -> Float
1321
+ def self?.rand: (?0) -> Float
1322
+ | (int arg0) -> (Integer | Float)
1323
+ | (::Range[Integer] arg0) -> Integer?
1324
+ | (::Range[Float] arg0) -> Float?
1325
1325
 
1326
1326
  # <!--
1327
1327
  # rdoc-file=io.c
@@ -1564,7 +1564,7 @@ module Kernel : BasicObject
1564
1564
  # (snipped)
1565
1565
  # ping
1566
1566
  #
1567
- def self?.select: (::Array[IO] read, ?::Array[IO] write, ?::Array[IO] error, ?Integer timeout) -> ::Array[String]
1567
+ def self?.select: (::Array[IO] read, ?::Array[IO] write, ?::Array[IO] error, ?Time::_Timeout timeout) -> ::Array[String]
1568
1568
 
1569
1569
  # <!--
1570
1570
  # rdoc-file=process.c
@@ -1581,8 +1581,9 @@ module Kernel : BasicObject
1581
1581
  # Time.new # => 2008-03-08 19:56:22 +0900
1582
1582
  #
1583
1583
  def self?.sleep: (?nil) -> bot
1584
- | (Integer | Float | _Divmod duration) -> Integer
1584
+ | (Time::_Timeout duration) -> Integer
1585
1585
 
1586
+ %a{steep:deprecated}
1586
1587
  interface _Divmod
1587
1588
  def divmod: (Numeric) -> [ Numeric, Numeric ]
1588
1589
  end
@@ -2332,7 +2333,7 @@ module Kernel : BasicObject
2332
2333
  # k.extend(Mod) #=> #<Klass:0x401b3bc8>
2333
2334
  # k.hello #=> "Hello from Mod.\n"
2334
2335
  #
2335
- def extend: (*Module) -> self
2336
+ def extend: (Module, *Module) -> self
2336
2337
 
2337
2338
  # <!--
2338
2339
  # rdoc-file=object.c
data/core/module.rbs CHANGED
@@ -814,7 +814,7 @@ class Module < Object
814
814
  # -->
815
815
  # Invokes Module.append_features on each parameter in reverse order.
816
816
  #
817
- def include: (*Module arg0) -> self
817
+ def include: (Module, *Module arg0) -> self
818
818
 
819
819
  # <!--
820
820
  # rdoc-file=object.c
@@ -1147,7 +1147,11 @@ class Module < Object
1147
1147
  # Mod.one #=> "This is one"
1148
1148
  # c.call_one #=> "This is the new one"
1149
1149
  #
1150
- def module_function: (*interned arg0) -> self
1150
+ def module_function: () -> nil
1151
+ | (Symbol method_name) -> Symbol
1152
+ | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
1153
+ | (string method_name) -> string
1154
+ | (interned, interned, *interned method_name) -> Array[interned]
1151
1155
 
1152
1156
  # <!--
1153
1157
  # rdoc-file=object.c
@@ -1163,7 +1167,7 @@ class Module < Object
1163
1167
  # -->
1164
1168
  # Invokes Module.prepend_features on each parameter in reverse order.
1165
1169
  #
1166
- def prepend: (*Module arg0) -> self
1170
+ def prepend: (Module, *Module arg0) -> self
1167
1171
 
1168
1172
  # <!--
1169
1173
  # rdoc-file=eval.c
@@ -1225,6 +1229,7 @@ class Module < Object
1225
1229
  | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
1226
1230
  | (string method_name) -> string
1227
1231
  | (interned, interned, *interned method_name) -> Array[interned]
1232
+ | (Array[interned]) -> Array[interned]
1228
1233
 
1229
1234
  # <!--
1230
1235
  # rdoc-file=vm_method.c
@@ -1247,6 +1252,7 @@ class Module < Object
1247
1252
  # end
1248
1253
  #
1249
1254
  def private_class_method: (*interned arg0) -> self
1255
+ | (Array[interned] arg0) -> self
1250
1256
 
1251
1257
  # <!--
1252
1258
  # rdoc-file=object.c
@@ -1326,7 +1332,12 @@ class Module < Object
1326
1332
  #
1327
1333
  # To show a private method on RDoc, use `:doc:` instead of this.
1328
1334
  #
1329
- def protected: (*interned arg0) -> self
1335
+ def protected: () -> nil
1336
+ | (Symbol method_name) -> Symbol
1337
+ | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
1338
+ | (string method_name) -> string
1339
+ | (interned, interned, *interned method_name) -> Array[interned]
1340
+ | (Array[interned]) -> Array[interned]
1330
1341
 
1331
1342
  # <!--
1332
1343
  # rdoc-file=object.c
@@ -1386,6 +1397,7 @@ class Module < Object
1386
1397
  | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
1387
1398
  | (string method_name) -> string
1388
1399
  | (interned, interned, *interned method_name) -> Array[interned]
1400
+ | (Array[interned]) -> Array[interned]
1389
1401
 
1390
1402
  # <!--
1391
1403
  # rdoc-file=vm_method.c
@@ -1399,6 +1411,7 @@ class Module < Object
1399
1411
  # is also accepted.
1400
1412
  #
1401
1413
  def public_class_method: (*interned arg0) -> self
1414
+ | (Array[interned] arg0) -> self
1402
1415
 
1403
1416
  # <!--
1404
1417
  # rdoc-file=object.c
data/core/range.rbs CHANGED
@@ -961,8 +961,8 @@ class Range[out Elem] < Object
961
961
  #
962
962
  # Related: Range#%.
963
963
  #
964
- def step: (?Integer n) { (Elem arg0) -> untyped } -> self
965
- | (?Integer n) -> ::Enumerator[Elem, void]
964
+ def step: (?Numeric | int n) -> Enumerator[Elem, self]
965
+ | (?Numeric | int n) { (Elem element) -> void } -> self
966
966
 
967
967
  # <!--
968
968
  # rdoc-file=range.c