rbs 3.5.2 → 3.6.0.dev.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dependabot.yml +5 -1
  3. data/.github/workflows/ruby.yml +2 -18
  4. data/.github/workflows/windows.yml +26 -0
  5. data/CHANGELOG.md +0 -12
  6. data/core/array.rbs +10 -10
  7. data/core/basic_object.rbs +3 -3
  8. data/core/enumerable.rbs +6 -0
  9. data/core/enumerator.rbs +7 -0
  10. data/core/fiber.rbs +1 -1
  11. data/core/global_variables.rbs +2 -2
  12. data/core/kernel.rbs +67 -38
  13. data/core/method.rbs +98 -7
  14. data/core/module.rbs +2 -2
  15. data/core/proc.rbs +184 -23
  16. data/core/ractor.rbs +1 -1
  17. data/core/range.rbs +30 -0
  18. data/core/refinement.rbs +16 -26
  19. data/core/symbol.rbs +34 -26
  20. data/core/thread.rbs +2 -2
  21. data/core/trace_point.rbs +12 -12
  22. data/core/unbound_method.rbs +1 -1
  23. data/docs/syntax.md +21 -9
  24. data/ext/rbs_extension/parser.c +135 -55
  25. data/ext/rbs_extension/parserstate.c +2 -7
  26. data/ext/rbs_extension/parserstate.h +6 -5
  27. data/ext/rbs_extension/ruby_objs.c +2 -1
  28. data/ext/rbs_extension/ruby_objs.h +1 -1
  29. data/lib/rbs/ast/declarations.rb +36 -0
  30. data/lib/rbs/ast/type_param.rb +71 -15
  31. data/lib/rbs/ast/visitor.rb +137 -0
  32. data/lib/rbs/cli/validate.rb +41 -7
  33. data/lib/rbs/cli.rb +3 -3
  34. data/lib/rbs/definition.rb +2 -1
  35. data/lib/rbs/definition_builder/ancestor_builder.rb +30 -4
  36. data/lib/rbs/definition_builder.rb +21 -6
  37. data/lib/rbs/environment_loader.rb +1 -1
  38. data/lib/rbs/errors.rb +7 -2
  39. data/lib/rbs/file_finder.rb +9 -12
  40. data/lib/rbs/locator.rb +8 -5
  41. data/lib/rbs/prototype/rbi.rb +2 -1
  42. data/lib/rbs/prototype/runtime.rb +3 -2
  43. data/lib/rbs/sorter.rb +9 -6
  44. data/lib/rbs/test/type_check.rb +6 -0
  45. data/lib/rbs/types.rb +11 -0
  46. data/lib/rbs/validator.rb +2 -2
  47. data/lib/rbs/vendorer.rb +3 -3
  48. data/lib/rbs/version.rb +1 -1
  49. data/lib/rbs.rb +1 -0
  50. data/sig/declarations.rbs +6 -0
  51. data/sig/definition.rbs +1 -1
  52. data/sig/definition_builder.rbs +3 -1
  53. data/sig/errors.rbs +3 -2
  54. data/sig/file_finder.rbs +24 -2
  55. data/sig/method_types.rbs +1 -1
  56. data/sig/sorter.rbs +1 -1
  57. data/sig/type_param.rbs +41 -9
  58. data/sig/types.rbs +12 -0
  59. data/sig/visitor.rbs +47 -0
  60. data/stdlib/csv/0/csv.rbs +27 -0
  61. data/stdlib/net-http/0/net-http.rbs +1 -1
  62. data/stdlib/zlib/0/gzip_reader.rbs +5 -1
  63. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9764851079fa89592891f71a26c6eee69864530b07b78e11095b5fdd49b3f6e
4
- data.tar.gz: 4fa3989f4f1508aff037e9f07d708f8b14355d133415c088ae8a61abec5ad114
3
+ metadata.gz: f9c653ea578000329720980ce7845237e8c49c9319a72c5a4f5bc315306cde02
4
+ data.tar.gz: e9ccad52c36cd4ef0509ce78ab0d857810b80ed6489d8b6b1fcdac0af47f5e59
5
5
  SHA512:
6
- metadata.gz: 95b8dd11d46e7d395bb72fe698e6607eea742d02b1fe78309b030f3e921be8400367abf8ce3985b9afa35febb596fb196d532a420d641f1d6cf1bab78fdfdf38
7
- data.tar.gz: bf4153dcdbf740345ed312a75a6452475d1faeb92f5fa7f07d5c0f153582be935c4952aa3ed53dc20f579da0d2ed219f80cda826c575c416d34bb3a9c5ff98d8
6
+ metadata.gz: c2468b174c0800686e77f26122898d84e2f2506b5b91074d30d18766ce60992257bd560843972ddf72c77e9b8bda26dfb58f012893dbae1585f994fecd480a7b
7
+ data.tar.gz: 9c534d38496760cc1ad91f8776e83e61672305c564c6b14fc206fd202817a5be2d60d675558dfbe6b9fadbf9f980c595c2432c821cae38a5b447857d5601ab5e
@@ -11,8 +11,11 @@ env:
11
11
  jobs:
12
12
  dependabot:
13
13
  runs-on: ubuntu-latest
14
- if: ${{ github.actor == 'dependabot[bot]' }}
14
+ if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
15
15
  steps:
16
+ - name: Dependabot metadata
17
+ uses: dependabot/fetch-metadata@dbb049abf0d677abbd7f7eee0375145b417fdd34 # v2.2.0
18
+ id: metadata
16
19
  - name: Checkout repository
17
20
  uses: actions/checkout@v4
18
21
  with:
@@ -21,6 +24,7 @@ jobs:
21
24
  run: git diff --exit-code ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} ${{ env.blocker_files }}
22
25
  - name: Enable auto-merge for Dependabot PRs
23
26
  run: gh pr merge --auto --merge "$PR_URL"
27
+ if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch' }}
24
28
  env:
25
29
  PR_URL: ${{github.event.pull_request.html_url}}
26
30
  GH_TOKEN: ${{secrets.DEPENDABOT_MERGE_GH_TOKEN}}
@@ -42,6 +42,8 @@ jobs:
42
42
  bundler: none
43
43
  - name: Set working directory as safe
44
44
  run: git config --global --add safe.directory $(pwd)
45
+ - name: Set up permission
46
+ run: chmod -R o-w /opt/hostedtoolcache/Ruby
45
47
  - name: Install dependencies
46
48
  run: |
47
49
  sudo apt-get update
@@ -76,21 +78,3 @@ jobs:
76
78
  - name: Run test
77
79
  run: |
78
80
  bundle exec rake ${{ matrix.job }}
79
-
80
- windows:
81
- runs-on: ${{ matrix.os }}
82
- strategy:
83
- fail-fast: false
84
- matrix:
85
- os: [windows-2019, windows-2022]
86
- ruby: [ucrt, mswin]
87
- steps:
88
- - uses: actions/checkout@v4
89
- - name: load ruby
90
- uses: ruby/setup-ruby@v1
91
- with:
92
- ruby-version: ${{ matrix.ruby }}
93
- - name: rake-compiler
94
- run: gem install rake-compiler
95
- - name: compile
96
- run: rake compile
@@ -0,0 +1,26 @@
1
+ name: Ruby on Windows
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request: {}
8
+ merge_group: {}
9
+
10
+ jobs:
11
+ compile:
12
+ runs-on: "windows-latest"
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ ruby: ['3.2', '3.3', ucrt, mswin]
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - name: load ruby
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby }}
23
+ - name: rake-compiler
24
+ run: gem install rake-compiler
25
+ - name: compile
26
+ run: rake compile
data/CHANGELOG.md CHANGED
@@ -1,17 +1,5 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 3.5.2 (2024-07-10)
4
-
5
- ### Library changes
6
-
7
- * Update docs for ruby-3.3.4 ([#1923](https://github.com/ruby/rbs/pull/1923), Backported in [#1925](https://github.com/ruby/rbs/pull/1925))
8
- * Update docs for ruby-3.3.3 ([#1889](https://github.com/ruby/rbs/pull/1889), Backported in [#1925](https://github.com/ruby/rbs/pull/1925))
9
- * Fix #1905: Fix typo in `UntypedFunction` ([#1906](https://github.com/ruby/rbs/pull/1906), Backported in [#1925](https://github.com/ruby/rbs/pull/1925))
10
-
11
- ### Miscellaneous
12
-
13
- * Use `File.open` instead of `IO.sysopen` ([#1913](https://github.com/ruby/rbs/pull/1913))
14
-
15
3
  ## 3.5.1 (2024-06-07)
16
4
 
17
5
  ### Library changes
data/core/array.rbs CHANGED
@@ -1082,7 +1082,7 @@ class Array[unchecked out Elem] < Object
1082
1082
  # a.at(0) # => :foo
1083
1083
  # a.at(2) # => 2
1084
1084
  #
1085
- def at: (int index) -> Elem?
1085
+ def at: %a{implicitly-returns-nil} (int index) -> Elem
1086
1086
 
1087
1087
  # <!--
1088
1088
  # rdoc-file=array.c
@@ -1378,7 +1378,7 @@ class Array[unchecked out Elem] < Object
1378
1378
  #
1379
1379
  # If `index` is too small (far from zero), returns nil.
1380
1380
  #
1381
- def delete_at: (int index) -> Elem?
1381
+ def delete_at: %a{implicitly-returns-nil} (int index) -> Elem
1382
1382
 
1383
1383
  # <!--
1384
1384
  # rdoc-file=array.c
@@ -1942,7 +1942,7 @@ class Array[unchecked out Elem] < Object
1942
1942
  #
1943
1943
  # Related: #last.
1944
1944
  #
1945
- def first: () -> Elem?
1945
+ def first: %a{implicitly-returns-nil} () -> Elem
1946
1946
  | (int n) -> ::Array[Elem]
1947
1947
 
1948
1948
  # <!--
@@ -2241,7 +2241,7 @@ class Array[unchecked out Elem] < Object
2241
2241
  #
2242
2242
  # Related: #first.
2243
2243
  #
2244
- def last: () -> Elem?
2244
+ def last: %a{implicitly-returns-nil} () -> Elem
2245
2245
  | (int n) -> ::Array[Elem]
2246
2246
 
2247
2247
  # <!--
@@ -2321,8 +2321,8 @@ class Array[unchecked out Elem] < Object
2321
2321
  #
2322
2322
  # ['0', '00', '000'].max(2) {|a, b| a.size <=> b.size } # => ["000", "00"]
2323
2323
  #
2324
- def max: () -> Elem?
2325
- | () { (Elem a, Elem b) -> ::Integer? } -> Elem?
2324
+ def max: %a{implicitly-returns-nil} () -> Elem
2325
+ | %a{implicitly-returns-nil} () { (Elem a, Elem b) -> ::Integer? } -> Elem
2326
2326
  | (int n) -> ::Array[Elem]
2327
2327
  | (int n) { (Elem a, Elem b) -> ::Integer? } -> ::Array[Elem]
2328
2328
 
@@ -3118,7 +3118,7 @@ class Array[unchecked out Elem] < Object
3118
3118
  # a.sample(random: Random.new(1)) #=> 6
3119
3119
  # a.sample(4, random: Random.new(1)) #=> [6, 10, 9, 2]
3120
3120
  #
3121
- def sample: (?random: _Rand rng) -> Elem?
3121
+ def sample: %a{implicitly-returns-nil} (?random: _Rand rng) -> Elem
3122
3122
  | (int n, ?random: _Rand rng) -> ::Array[Elem]
3123
3123
 
3124
3124
  # <!--
@@ -3197,7 +3197,7 @@ class Array[unchecked out Elem] < Object
3197
3197
  #
3198
3198
  # Related: #push, #pop, #unshift.
3199
3199
  #
3200
- def shift: () -> Elem?
3200
+ def shift: %a{implicitly-returns-nil} () -> Elem
3201
3201
  | (int n) -> ::Array[Elem]
3202
3202
 
3203
3203
  # <!--
@@ -3323,7 +3323,7 @@ class Array[unchecked out Elem] < Object
3323
3323
  # # Raises TypeError (no implicit conversion of Symbol into Integer):
3324
3324
  # a[:foo]
3325
3325
  #
3326
- def slice: (int index) -> Elem?
3326
+ def slice: %a{implicitly-returns-nil} (int index) -> Elem
3327
3327
  | (int start, int length) -> ::Array[Elem]?
3328
3328
  | (::Range[::Integer] range) -> ::Array[Elem]?
3329
3329
 
@@ -3393,7 +3393,7 @@ class Array[unchecked out Elem] < Object
3393
3393
  # a.slice!(-2..2) # => ["bar", 2]
3394
3394
  # a # => [:foo]
3395
3395
  #
3396
- def slice!: (int index) -> Elem?
3396
+ def slice!: %a{implicitly-returns-nil} (int index) -> Elem
3397
3397
  | (int start, int length) -> ::Array[Elem]?
3398
3398
  | (::Range[::Integer] range) -> ::Array[Elem]?
3399
3399
 
@@ -163,7 +163,7 @@ class BasicObject
163
163
  # k = Klass.new
164
164
  # k.send :hello, "gentle", "readers" #=> "Hello gentle readers"
165
165
  #
166
- def __send__: (interned name, *untyped, **untyped) ?{ (*untyped, **untyped) -> untyped } -> untyped
166
+ def __send__: (interned name, *untyped, **untyped) ?{ (?) -> untyped } -> untyped
167
167
 
168
168
  # <!-- rdoc-file=object.c -->
169
169
  # Equality --- At the Object level, #== returns `true` only if `obj` and `other`
@@ -248,7 +248,7 @@ class BasicObject
248
248
  # k = KlassWithSecret.new
249
249
  # k.instance_exec(5) {|x| @secret+x } #=> 104
250
250
  #
251
- def instance_exec: [U, V] (*V args) { (*V args) [self: self] -> U } -> U
251
+ def instance_exec: [U] (*untyped, **untyped) { (?) [self: self] -> U } -> U
252
252
 
253
253
  # <!--
254
254
  # rdoc-file=object.c
@@ -295,7 +295,7 @@ class BasicObject
295
295
  # r.mm #=> 2000
296
296
  # r.foo #=> NoMethodError
297
297
  #
298
- def method_missing: (Symbol, *untyped, **untyped) ?{ (*untyped, **untyped) -> untyped } -> untyped
298
+ def method_missing: (Symbol, *untyped, **untyped) ?{ (?) -> untyped } -> untyped
299
299
 
300
300
  # <!--
301
301
  # rdoc-file=object.c
data/core/enumerable.rbs CHANGED
@@ -528,6 +528,12 @@ module Enumerable[unchecked out Elem] : _Each[Elem]
528
528
  #
529
529
  def entries: () -> ::Array[Elem]
530
530
 
531
+ def enum_for: (Symbol method, *untyped, **untyped) ?{ (?) -> Integer } -> Enumerator[untyped, untyped]
532
+ | () ?{ () -> Integer } -> Enumerator[Elem, self]
533
+
534
+ %a{annotate:rdoc:skip}
535
+ alias to_enum enum_for
536
+
531
537
  # <!--
532
538
  # rdoc-file=enum.c
533
539
  # - select {|element| ... } -> array
data/core/enumerator.rbs CHANGED
@@ -130,6 +130,13 @@
130
130
  class Enumerator[unchecked out Elem, out Return] < Object
131
131
  include Enumerable[Elem]
132
132
 
133
+ # A convenience interface for `each` with optional block
134
+ #
135
+ interface _Each[out E, out R]
136
+ def each: () { (E) -> void } -> R
137
+ | () -> Enumerator[E, R]
138
+ end
139
+
133
140
  # <!--
134
141
  # rdoc-file=enumerator.c
135
142
  # - Enumerator.produce(initial = nil) { |prev| block } -> enumerator
data/core/fiber.rbs CHANGED
@@ -268,7 +268,7 @@ class Fiber < Object
268
268
  # Explicitly using `storage: true` is currently experimental and may change in
269
269
  # the future.
270
270
  #
271
- def initialize: (?blocking: boolish, ?storage: true | Hash[interned, untyped] | nil) { (*untyped) -> void } -> void
271
+ def initialize: (?blocking: boolish, ?storage: true | Hash[interned, untyped] | nil) { (?) -> void } -> void
272
272
 
273
273
  # <!--
274
274
  # rdoc-file=cont.c
@@ -118,7 +118,7 @@ $;: Regexp | String | nil
118
118
  $<: RBS::Unnamed::ARGFClass
119
119
 
120
120
  # This variable is no longer effective. Deprecated.
121
- $=: bool
121
+ $=: false
122
122
 
123
123
  # The default output stream for Kernel#print and Kernel#printf. $stdout by default.
124
124
  $>: IO
@@ -150,7 +150,7 @@ $LOADED_FEATURES: Array[String]
150
150
  $LOAD_PATH: Array[String] & _LoadPathAPI
151
151
 
152
152
  interface _LoadPathAPI
153
- def resolve_feature_path: (String) -> [:rb | :so, String]?
153
+ def resolve_feature_path: (path feature_path) -> [:rb | :so, String]?
154
154
  end
155
155
 
156
156
  # Contains the name of the script being executed. May be assignable.
data/core/kernel.rbs CHANGED
@@ -282,7 +282,7 @@ module Kernel : BasicObject
282
282
  # 1.class #=> Integer
283
283
  # self.class #=> Object
284
284
  #
285
- def class: () -> untyped
285
+ def class: () -> Class
286
286
 
287
287
  # <!--
288
288
  # rdoc-file=vm_eval.c
@@ -2066,7 +2066,7 @@ module Kernel : BasicObject
2066
2066
  # Returns true if two objects do not match (using the *=~* method), otherwise
2067
2067
  # false.
2068
2068
  #
2069
- def !~: (untyped) -> bool
2069
+ def !~: (untyped other) -> bool
2070
2070
 
2071
2071
  # <!--
2072
2072
  # rdoc-file=object.c
@@ -2086,7 +2086,7 @@ module Kernel : BasicObject
2086
2086
  # When you define #<=>, you can include Comparable to gain the methods #<=, #<,
2087
2087
  # #==, #>=, #> and #between?.
2088
2088
  #
2089
- def <=>: (untyped) -> Integer?
2089
+ def <=>: (untyped other) -> 0?
2090
2090
 
2091
2091
  # <!--
2092
2092
  # rdoc-file=object.c
@@ -2096,7 +2096,7 @@ module Kernel : BasicObject
2096
2096
  # typically overridden by descendants to provide meaningful semantics in `case`
2097
2097
  # statements.
2098
2098
  #
2099
- def ===: (untyped) -> bool
2099
+ alias === ==
2100
2100
 
2101
2101
  # <!--
2102
2102
  # rdoc-file=kernel.rb
@@ -2152,8 +2152,8 @@ module Kernel : BasicObject
2152
2152
  # chris.define_singleton_method(:greet) {|greeting| "#{greeting}, I'm Chris!" }
2153
2153
  # chris.greet("Hi") #=> "Hi, I'm Chris!"
2154
2154
  #
2155
- def define_singleton_method: (interned, Method | UnboundMethod | Proc method) -> Symbol
2156
- | (interned) { (*untyped) -> untyped } -> Symbol
2155
+ def define_singleton_method: (interned name, Method | UnboundMethod | Proc method) -> Symbol
2156
+ | (interned name) { (?) -> untyped } -> Symbol
2157
2157
 
2158
2158
  # <!--
2159
2159
  # rdoc-file=io.c
@@ -2170,7 +2170,7 @@ module Kernel : BasicObject
2170
2170
  #
2171
2171
  # 1cat[4, 5, 6]
2172
2172
  #
2173
- def display: (?_Writer port) -> void
2173
+ def display: (?_Writer port) -> nil
2174
2174
 
2175
2175
  # <!--
2176
2176
  # rdoc-file=object.c
@@ -2210,7 +2210,7 @@ module Kernel : BasicObject
2210
2210
  # s3 = s1.dup #=> #<Klass:0x401c1084>
2211
2211
  # s3.foo #=> NoMethodError: undefined method `foo' for #<Klass:0x401c1084>
2212
2212
  #
2213
- def dup: () -> self
2213
+ def dup: () -> instance
2214
2214
 
2215
2215
  # <!-- rdoc-file=enumerator.c -->
2216
2216
  # Creates a new Enumerator which will enumerate by calling `method` on `obj`,
@@ -2267,10 +2267,8 @@ module Kernel : BasicObject
2267
2267
  # enum.first(4) # => [1, 1, 1, 2]
2268
2268
  # enum.size # => 42
2269
2269
  #
2270
- def enum_for: (Symbol method, *untyped, **untyped) ?{ (*untyped, **untyped) -> Integer } -> Enumerator[untyped, untyped]
2271
- | () ?{ () -> Integer } -> Enumerator[untyped, self]
2270
+ def enum_for: (?interned method, *untyped, **untyped) ?{ (*untyped, **untyped) -> Integer } -> Enumerator[untyped, untyped]
2272
2271
 
2273
- %a{annotate:rdoc:skip}
2274
2272
  alias to_enum enum_for
2275
2273
 
2276
2274
  # <!--
@@ -2308,7 +2306,7 @@ module Kernel : BasicObject
2308
2306
  # 1 == 1.0 #=> true
2309
2307
  # 1.eql? 1.0 #=> false
2310
2308
  #
2311
- def eql?: (untyped) -> bool
2309
+ def eql?: (untyped other) -> bool
2312
2310
 
2313
2311
  # <!--
2314
2312
  # rdoc-file=eval.c
@@ -2333,7 +2331,7 @@ module Kernel : BasicObject
2333
2331
  # k.extend(Mod) #=> #<Klass:0x401b3bc8>
2334
2332
  # k.hello #=> "Hello from Mod.\n"
2335
2333
  #
2336
- def extend: (Module, *Module) -> self
2334
+ def extend: (Module module, *Module other_modules) -> self
2337
2335
 
2338
2336
  # <!--
2339
2337
  # rdoc-file=object.c
@@ -2447,7 +2445,7 @@ module Kernel : BasicObject
2447
2445
  # b.instance_of? B #=> true
2448
2446
  # b.instance_of? C #=> false
2449
2447
  #
2450
- def instance_of?: (Module) -> bool
2448
+ def instance_of?: (Module | Class module_or_class) -> bool
2451
2449
 
2452
2450
  # <!--
2453
2451
  # rdoc-file=object.c
@@ -2467,7 +2465,7 @@ module Kernel : BasicObject
2467
2465
  # fred.instance_variable_defined?("@b") #=> true
2468
2466
  # fred.instance_variable_defined?("@c") #=> false
2469
2467
  #
2470
- def instance_variable_defined?: (interned var) -> bool
2468
+ def instance_variable_defined?: (interned variable) -> bool
2471
2469
 
2472
2470
  # <!--
2473
2471
  # rdoc-file=object.c
@@ -2489,7 +2487,7 @@ module Kernel : BasicObject
2489
2487
  # fred.instance_variable_get(:@a) #=> "cat"
2490
2488
  # fred.instance_variable_get("@b") #=> 99
2491
2489
  #
2492
- def instance_variable_get: (interned var) -> untyped
2490
+ def instance_variable_get: (interned variable) -> untyped
2493
2491
 
2494
2492
  # <!--
2495
2493
  # rdoc-file=object.c
@@ -2512,7 +2510,7 @@ module Kernel : BasicObject
2512
2510
  # fred.instance_variable_set(:@c, 'cat') #=> "cat"
2513
2511
  # fred.inspect #=> "#<Fred:0x401b3da8 @a=\"dog\", @b=99, @c=\"cat\">"
2514
2512
  #
2515
- def instance_variable_set: [X] (interned var, X value) -> X
2513
+ def instance_variable_set: [T] (interned variable, T value) -> T
2516
2514
 
2517
2515
  # <!--
2518
2516
  # rdoc-file=object.c
@@ -2553,9 +2551,8 @@ module Kernel : BasicObject
2553
2551
  # b.kind_of? C #=> false
2554
2552
  # b.kind_of? M #=> true
2555
2553
  #
2556
- def is_a?: (Module) -> bool
2554
+ def is_a?: (Module | Class module_or_class) -> bool
2557
2555
 
2558
- %a{annotate:rdoc:skip}
2559
2556
  alias kind_of? is_a?
2560
2557
 
2561
2558
  # <!--
@@ -2636,7 +2633,7 @@ module Kernel : BasicObject
2636
2633
  # k.extend M123
2637
2634
  # k.methods(false) #=> [:singleton_method]
2638
2635
  #
2639
- def methods: () -> Array[Symbol]
2636
+ def methods: (?boolish regular) -> Array[Symbol]
2640
2637
 
2641
2638
  # <!--
2642
2639
  # rdoc-file=object.c
@@ -2647,7 +2644,7 @@ module Kernel : BasicObject
2647
2644
  # Object.new.nil? #=> false
2648
2645
  # nil.nil? #=> true
2649
2646
  #
2650
- def nil?: () -> bool
2647
+ def nil?: () -> false
2651
2648
 
2652
2649
  # <!--
2653
2650
  # rdoc-file=gc.c
@@ -2672,7 +2669,7 @@ module Kernel : BasicObject
2672
2669
  # "hello".object_id == "hello".object_id # => false
2673
2670
  # "hi".freeze.object_id == "hi".freeze.object_id # => true
2674
2671
  #
2675
- def object_id: () -> Integer
2672
+ alias object_id __id__
2676
2673
 
2677
2674
  # <!--
2678
2675
  # rdoc-file=object.c
@@ -2682,7 +2679,7 @@ module Kernel : BasicObject
2682
2679
  # parameter is set to `false`, only those methods in the receiver will be
2683
2680
  # listed.
2684
2681
  #
2685
- def private_methods: () -> Array[Symbol]
2682
+ def private_methods: (?boolish all) -> Array[Symbol]
2686
2683
 
2687
2684
  # <!--
2688
2685
  # rdoc-file=object.c
@@ -2692,7 +2689,7 @@ module Kernel : BasicObject
2692
2689
  # parameter is set to `false`, only those methods in the receiver will be
2693
2690
  # listed.
2694
2691
  #
2695
- def protected_methods: () -> Array[Symbol]
2692
+ def protected_methods: (?boolish all) -> Array[Symbol]
2696
2693
 
2697
2694
  # <!--
2698
2695
  # rdoc-file=proc.c
@@ -2722,7 +2719,7 @@ module Kernel : BasicObject
2722
2719
  #
2723
2720
  # 1.public_send(:puts, "hello") # causes NoMethodError
2724
2721
  #
2725
- def public_send: (interned name, *untyped args) ?{ (*untyped) -> untyped } -> untyped
2722
+ def public_send: (interned name, *untyped, **untyped) ?{ (?) -> untyped } -> untyped
2726
2723
 
2727
2724
  # <!--
2728
2725
  # rdoc-file=object.c
@@ -2746,7 +2743,7 @@ module Kernel : BasicObject
2746
2743
  # d.remove #=> 99
2747
2744
  # d.var #=> nil
2748
2745
  #
2749
- def remove_instance_variable: (interned name) -> untyped
2746
+ def remove_instance_variable: (interned variable) -> untyped
2750
2747
 
2751
2748
  # <!--
2752
2749
  # rdoc-file=vm_method.c
@@ -2782,8 +2779,7 @@ module Kernel : BasicObject
2782
2779
  #
2783
2780
  # See #respond_to?, and the example of BasicObject.
2784
2781
  #
2785
- %a{annotate:rdoc:copy:Object#respond_to_missing?}
2786
- private def respond_to_missing?: (Symbol, bool) -> bool
2782
+ private def respond_to_missing?: (Symbol | String name, bool include_all) -> bool
2787
2783
 
2788
2784
  # <!--
2789
2785
  # rdoc-file=vm_eval.c
@@ -2808,7 +2804,7 @@ module Kernel : BasicObject
2808
2804
  # k = Klass.new
2809
2805
  # k.send :hello, "gentle", "readers" #=> "Hello gentle readers"
2810
2806
  #
2811
- def send: (interned name, *untyped args) ?{ (*untyped) -> untyped } -> untyped
2807
+ alias send __send__
2812
2808
 
2813
2809
  # <!--
2814
2810
  # rdoc-file=object.c
@@ -2883,7 +2879,7 @@ module Kernel : BasicObject
2883
2879
  # a.singleton_methods(false) #=> [:two, :one]
2884
2880
  # a.singleton_methods #=> [:two, :one, :three]
2885
2881
  #
2886
- def singleton_methods: () -> Array[Symbol]
2882
+ def singleton_methods: (?boolish all) -> Array[Symbol]
2887
2883
 
2888
2884
  # <!--
2889
2885
  # rdoc-file=kernel.rb
@@ -2919,17 +2915,50 @@ module Kernel : BasicObject
2919
2915
  #
2920
2916
  # "my string".yield_self {|s| s.upcase } #=> "MY STRING"
2921
2917
  #
2922
- def yield_self: [X] () { (self) -> X } -> X
2923
- | () -> Enumerator[self, untyped]
2918
+ def yield_self: () -> Enumerator[self, untyped]
2919
+ | [T] () { (self) -> T } -> T
2924
2920
 
2925
- %a{annotate:rdoc:skip}
2921
+ # <!--
2922
+ # rdoc-file=kernel.rb
2923
+ # - obj.then {|x| block } -> an_object
2924
+ # -->
2925
+ # Yields self to the block and returns the result of the block.
2926
+ #
2927
+ # 3.next.then {|x| x**x }.to_s #=> "256"
2928
+ #
2929
+ # Good usage for `then` is value piping in method chains:
2930
+ #
2931
+ # require 'open-uri'
2932
+ # require 'json'
2933
+ #
2934
+ # construct_url(arguments).
2935
+ # then {|url| URI(url).read }.
2936
+ # then {|response| JSON.parse(response) }
2937
+ #
2938
+ # When called without block, the method returns `Enumerator`, which can be used,
2939
+ # for example, for conditional circuit-breaking:
2940
+ #
2941
+ # # meets condition, no-op
2942
+ # 1.then.detect(&:odd?) # => 1
2943
+ # # does not meet condition, drop value
2944
+ # 2.then.detect(&:odd?) # => nil
2945
+ #
2946
+ # Good usage for `then` is value piping in method chains:
2947
+ #
2948
+ # require 'open-uri'
2949
+ # require 'json'
2950
+ #
2951
+ # construct_url(arguments).
2952
+ # then {|url| URI(url).read }.
2953
+ # then {|response| JSON.parse(response) }
2954
+ #
2926
2955
  alias then yield_self
2927
2956
 
2928
- private def initialize_copy: (self object) -> self
2957
+ private
2929
2958
 
2930
- private def initialize_clone: (self object, ?freeze: bool?) -> self
2959
+ def initialize_copy: (instance object) -> self
2931
2960
 
2932
- private def initialize_dup: (self object) -> self
2933
- end
2961
+ def initialize_clone: (instance object, ?freeze: bool?) -> self
2934
2962
 
2935
- Kernel::RUBYGEMS_ACTIVATION_MONITOR: untyped
2963
+ def initialize_dup: (instance object) -> self
2964
+ end