rbs 3.10.2 → 4.0.0.dev.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 (205) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +2 -2
  3. data/.github/workflows/ruby.yml +24 -34
  4. data/.github/workflows/typecheck.yml +3 -1
  5. data/.github/workflows/windows.yml +2 -2
  6. data/.gitignore +0 -4
  7. data/CHANGELOG.md +0 -107
  8. data/README.md +1 -38
  9. data/Rakefile +20 -142
  10. data/Steepfile +1 -0
  11. data/config.yml +43 -1
  12. data/core/array.rbs +46 -96
  13. data/core/comparable.rbs +6 -13
  14. data/core/complex.rbs +25 -40
  15. data/core/dir.rbs +4 -4
  16. data/core/encoding.rbs +9 -6
  17. data/core/enumerable.rbs +3 -90
  18. data/core/enumerator.rbs +1 -43
  19. data/core/errno.rbs +0 -8
  20. data/core/errors.rbs +1 -28
  21. data/core/exception.rbs +2 -2
  22. data/core/fiber.rbs +20 -29
  23. data/core/file.rbs +19 -49
  24. data/core/file_test.rbs +1 -1
  25. data/core/float.rbs +33 -224
  26. data/core/gc.rbs +281 -417
  27. data/core/hash.rbs +727 -1023
  28. data/core/integer.rbs +63 -104
  29. data/core/io/buffer.rbs +10 -21
  30. data/core/io/wait.rbs +33 -11
  31. data/core/io.rbs +12 -14
  32. data/core/kernel.rbs +51 -61
  33. data/core/marshal.rbs +1 -1
  34. data/core/match_data.rbs +1 -1
  35. data/core/math.rbs +3 -42
  36. data/core/method.rbs +25 -63
  37. data/core/module.rbs +23 -101
  38. data/core/nil_class.rbs +3 -3
  39. data/core/numeric.rbs +17 -25
  40. data/core/object.rbs +3 -3
  41. data/core/object_space.rbs +15 -21
  42. data/core/proc.rbs +24 -30
  43. data/core/process.rbs +2 -2
  44. data/core/ractor.rbs +509 -361
  45. data/core/range.rbs +8 -7
  46. data/core/rational.rbs +34 -56
  47. data/core/rbs/unnamed/argf.rbs +2 -2
  48. data/core/rbs/unnamed/env_class.rbs +1 -1
  49. data/core/rbs/unnamed/random.rbs +2 -4
  50. data/core/regexp.rbs +20 -25
  51. data/core/ruby_vm.rbs +4 -6
  52. data/core/rubygems/errors.rbs +70 -3
  53. data/core/rubygems/rubygems.rbs +79 -11
  54. data/core/rubygems/version.rbs +3 -2
  55. data/core/set.rbs +359 -488
  56. data/core/signal.rbs +14 -24
  57. data/core/string.rbs +1236 -3165
  58. data/core/struct.rbs +1 -1
  59. data/core/symbol.rbs +11 -17
  60. data/core/thread.rbs +33 -95
  61. data/core/time.rbs +9 -35
  62. data/core/trace_point.rbs +4 -7
  63. data/core/unbound_method.rbs +6 -14
  64. data/docs/collection.md +2 -2
  65. data/docs/gem.md +1 -0
  66. data/docs/sigs.md +3 -3
  67. data/ext/rbs_extension/ast_translation.c +1077 -944
  68. data/ext/rbs_extension/ast_translation.h +0 -7
  69. data/ext/rbs_extension/class_constants.c +83 -71
  70. data/ext/rbs_extension/class_constants.h +7 -4
  71. data/ext/rbs_extension/extconf.rb +2 -24
  72. data/ext/rbs_extension/legacy_location.c +172 -173
  73. data/ext/rbs_extension/legacy_location.h +3 -8
  74. data/ext/rbs_extension/main.c +289 -239
  75. data/ext/rbs_extension/rbs_extension.h +0 -3
  76. data/ext/rbs_extension/rbs_string_bridging.h +0 -4
  77. data/include/rbs/ast.h +98 -37
  78. data/include/rbs/defines.h +12 -38
  79. data/include/rbs/lexer.h +114 -126
  80. data/include/rbs/location.h +14 -14
  81. data/include/rbs/parser.h +37 -21
  82. data/include/rbs/string.h +5 -3
  83. data/include/rbs/util/rbs_allocator.h +19 -40
  84. data/include/rbs/util/rbs_assert.h +1 -12
  85. data/include/rbs/util/rbs_constant_pool.h +3 -3
  86. data/include/rbs/util/rbs_encoding.h +1 -3
  87. data/include/rbs/util/rbs_unescape.h +1 -2
  88. data/lib/rbs/ast/ruby/annotations.rb +119 -0
  89. data/lib/rbs/ast/ruby/comment_block.rb +221 -0
  90. data/lib/rbs/ast/ruby/declarations.rb +86 -0
  91. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +24 -0
  92. data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
  93. data/lib/rbs/ast/ruby/members.rb +213 -0
  94. data/lib/rbs/buffer.rb +104 -24
  95. data/lib/rbs/cli/validate.rb +40 -35
  96. data/lib/rbs/cli.rb +5 -6
  97. data/lib/rbs/collection/config/lockfile_generator.rb +0 -8
  98. data/lib/rbs/collection.rb +0 -1
  99. data/lib/rbs/definition.rb +6 -1
  100. data/lib/rbs/definition_builder/ancestor_builder.rb +65 -62
  101. data/lib/rbs/definition_builder/method_builder.rb +45 -30
  102. data/lib/rbs/definition_builder.rb +44 -9
  103. data/lib/rbs/environment/class_entry.rb +69 -0
  104. data/lib/rbs/environment/module_entry.rb +66 -0
  105. data/lib/rbs/environment.rb +244 -218
  106. data/lib/rbs/environment_loader.rb +8 -2
  107. data/lib/rbs/errors.rb +5 -4
  108. data/lib/rbs/inline_parser/comment_association.rb +117 -0
  109. data/lib/rbs/inline_parser.rb +206 -0
  110. data/lib/rbs/location_aux.rb +35 -3
  111. data/lib/rbs/parser_aux.rb +11 -6
  112. data/lib/rbs/prototype/runtime.rb +2 -2
  113. data/lib/rbs/resolver/constant_resolver.rb +2 -2
  114. data/lib/rbs/resolver/type_name_resolver.rb +38 -124
  115. data/lib/rbs/source.rb +99 -0
  116. data/lib/rbs/subtractor.rb +5 -6
  117. data/lib/rbs/test/type_check.rb +0 -14
  118. data/lib/rbs/types.rb +1 -3
  119. data/lib/rbs/version.rb +1 -1
  120. data/lib/rbs.rb +13 -1
  121. data/lib/rdoc/discover.rb +1 -1
  122. data/lib/rdoc_plugin/parser.rb +1 -1
  123. data/rbs.gemspec +1 -0
  124. data/sig/ancestor_builder.rbs +1 -1
  125. data/sig/ast/ruby/annotations.rbs +110 -0
  126. data/sig/ast/ruby/comment_block.rbs +119 -0
  127. data/sig/ast/ruby/declarations.rbs +60 -0
  128. data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
  129. data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
  130. data/sig/ast/ruby/members.rbs +72 -0
  131. data/sig/buffer.rbs +63 -5
  132. data/sig/definition.rbs +1 -0
  133. data/sig/definition_builder.rbs +1 -1
  134. data/sig/environment/class_entry.rbs +50 -0
  135. data/sig/environment/module_entry.rbs +50 -0
  136. data/sig/environment.rbs +28 -133
  137. data/sig/errors.rbs +13 -6
  138. data/sig/inline_parser/comment_association.rbs +71 -0
  139. data/sig/inline_parser.rbs +87 -0
  140. data/sig/location.rbs +32 -7
  141. data/sig/manifest.yaml +1 -0
  142. data/sig/method_builder.rbs +7 -4
  143. data/sig/parser.rbs +16 -20
  144. data/sig/resolver/type_name_resolver.rbs +7 -38
  145. data/sig/source.rbs +48 -0
  146. data/sig/types.rbs +1 -4
  147. data/src/ast.c +290 -201
  148. data/src/lexer.c +2813 -2902
  149. data/src/lexer.re +4 -0
  150. data/src/lexstate.c +155 -169
  151. data/src/location.c +40 -40
  152. data/src/parser.c +2665 -2433
  153. data/src/string.c +48 -0
  154. data/src/util/rbs_allocator.c +76 -92
  155. data/src/util/rbs_assert.c +10 -10
  156. data/src/util/rbs_buffer.c +2 -2
  157. data/src/util/rbs_constant_pool.c +15 -13
  158. data/src/util/rbs_encoding.c +4062 -20097
  159. data/src/util/rbs_unescape.c +48 -85
  160. data/stdlib/bigdecimal/0/big_decimal.rbs +82 -100
  161. data/stdlib/bigdecimal-math/0/big_math.rbs +8 -169
  162. data/stdlib/cgi/0/core.rbs +393 -9
  163. data/stdlib/cgi/0/manifest.yaml +0 -1
  164. data/stdlib/coverage/0/coverage.rbs +1 -3
  165. data/stdlib/date/0/date.rbs +59 -67
  166. data/stdlib/date/0/date_time.rbs +1 -1
  167. data/stdlib/delegate/0/delegator.rbs +7 -10
  168. data/stdlib/erb/0/erb.rbs +347 -737
  169. data/stdlib/fileutils/0/fileutils.rbs +13 -18
  170. data/stdlib/forwardable/0/forwardable.rbs +0 -3
  171. data/stdlib/json/0/json.rbs +48 -68
  172. data/stdlib/net-http/0/net-http.rbs +0 -3
  173. data/stdlib/objspace/0/objspace.rbs +4 -9
  174. data/stdlib/open-uri/0/open-uri.rbs +0 -40
  175. data/stdlib/openssl/0/openssl.rbs +228 -331
  176. data/stdlib/optparse/0/optparse.rbs +3 -3
  177. data/stdlib/pathname/0/pathname.rbs +1380 -10
  178. data/stdlib/psych/0/psych.rbs +3 -3
  179. data/stdlib/rdoc/0/rdoc.rbs +1 -1
  180. data/stdlib/resolv/0/resolv.rbs +68 -25
  181. data/stdlib/ripper/0/ripper.rbs +2 -5
  182. data/stdlib/singleton/0/singleton.rbs +0 -3
  183. data/stdlib/socket/0/socket.rbs +1 -13
  184. data/stdlib/socket/0/tcp_socket.rbs +2 -10
  185. data/stdlib/stringio/0/stringio.rbs +85 -1176
  186. data/stdlib/strscan/0/string_scanner.rbs +31 -31
  187. data/stdlib/tempfile/0/tempfile.rbs +3 -3
  188. data/stdlib/time/0/time.rbs +1 -1
  189. data/stdlib/timeout/0/timeout.rbs +7 -63
  190. data/stdlib/tsort/0/cyclic.rbs +0 -3
  191. data/stdlib/uri/0/common.rbs +2 -11
  192. data/stdlib/uri/0/file.rbs +1 -1
  193. data/stdlib/uri/0/generic.rbs +16 -17
  194. data/stdlib/uri/0/rfc2396_parser.rbs +7 -6
  195. data/stdlib/zlib/0/zstream.rbs +0 -1
  196. metadata +39 -12
  197. data/.clang-format +0 -74
  198. data/.clangd +0 -2
  199. data/.github/workflows/c-check.yml +0 -54
  200. data/core/pathname.rbs +0 -1272
  201. data/core/ruby.rbs +0 -53
  202. data/docs/aliases.md +0 -79
  203. data/docs/encoding.md +0 -56
  204. data/ext/rbs_extension/compat.h +0 -10
  205. data/stdlib/cgi-escape/0/escape.rbs +0 -171
data/core/struct.rbs CHANGED
@@ -130,7 +130,7 @@ class Struct[Elem]
130
130
  # Foo = Struct.new('Foo', :foo, :bar) # => Struct::Foo
131
131
  # f = Foo.new(0, 1) # => #<struct Struct::Foo foo=0, bar=1>
132
132
  #
133
- # **Class Name**
133
+ # **\Class Name**
134
134
  #
135
135
  # With string argument `class_name`, returns a new subclass of `Struct` named
136
136
  # `Struct::*class_name`*:
data/core/symbol.rbs CHANGED
@@ -130,25 +130,19 @@ class Symbol
130
130
 
131
131
  # <!--
132
132
  # rdoc-file=string.c
133
- # - self <=> other -> -1, 0, 1, or nil
133
+ # - symbol <=> object -> -1, 0, +1, or nil
134
134
  # -->
135
- # Compares `self` and `other`, using String#<=>.
135
+ # If `object` is a symbol, returns the equivalent of `symbol.to_s <=>
136
+ # object.to_s`:
136
137
  #
137
- # Returns:
138
+ # :bar <=> :foo # => -1
139
+ # :foo <=> :foo # => 0
140
+ # :foo <=> :bar # => 1
138
141
  #
139
- # * `self.to_s <=> other.to_s`, if `other` is a symbol.
140
- # * `nil`, otherwise.
142
+ # Otherwise, returns `nil`:
141
143
  #
142
- # Examples:
143
- #
144
- # :bar <=> :foo # => -1
145
- # :foo <=> :foo # => 0
146
- # :foo <=> :bar # => 1
147
144
  # :foo <=> 'bar' # => nil
148
145
  #
149
- # Class Symbol includes module Comparable, each of whose methods uses Symbol#<=>
150
- # for comparison.
151
- #
152
146
  # Related: String#<=>.
153
147
  #
154
148
  def <=>: (Symbol object) -> (-1 | 0 | 1)
@@ -194,7 +188,7 @@ class Symbol
194
188
 
195
189
  # <!--
196
190
  # rdoc-file=string.c
197
- # - capitalize(mapping) -> symbol
191
+ # - capitalize(*options) -> symbol
198
192
  # -->
199
193
  # Equivalent to `sym.to_s.capitalize.to_sym`.
200
194
  #
@@ -274,7 +268,7 @@ class Symbol
274
268
 
275
269
  # <!--
276
270
  # rdoc-file=string.c
277
- # - downcase(mapping) -> symbol
271
+ # - downcase(*options) -> symbol
278
272
  # -->
279
273
  # Equivalent to `sym.to_s.downcase.to_sym`.
280
274
  #
@@ -419,7 +413,7 @@ class Symbol
419
413
 
420
414
  # <!--
421
415
  # rdoc-file=string.c
422
- # - swapcase(mapping) -> symbol
416
+ # - swapcase(*options) -> symbol
423
417
  # -->
424
418
  # Equivalent to `sym.to_s.swapcase.to_sym`.
425
419
  #
@@ -468,7 +462,7 @@ class Symbol
468
462
 
469
463
  # <!--
470
464
  # rdoc-file=string.c
471
- # - upcase(mapping) -> symbol
465
+ # - upcase(*options) -> symbol
472
466
  # -->
473
467
  # Equivalent to `sym.to_s.upcase.to_sym`.
474
468
  #
data/core/thread.rbs CHANGED
@@ -265,10 +265,7 @@ class Thread < Object
265
265
  # -->
266
266
  # Terminates `thr` and schedules another thread to be run, returning the
267
267
  # terminated Thread. If this is the main thread, or the last thread, exits the
268
- # process. Note that the caller does not wait for the thread to terminate if the
269
- # receiver is different from the currently running thread. The termination is
270
- # asynchronous, and the thread can still run a small amount of ruby code before
271
- # exiting.
268
+ # process.
272
269
  #
273
270
  def kill: () -> Thread?
274
271
 
@@ -337,10 +334,7 @@ class Thread < Object
337
334
  # <!-- rdoc-file=thread.c -->
338
335
  # Terminates `thr` and schedules another thread to be run, returning the
339
336
  # terminated Thread. If this is the main thread, or the last thread, exits the
340
- # process. Note that the caller does not wait for the thread to terminate if the
341
- # receiver is different from the currently running thread. The termination is
342
- # asynchronous, and the thread can still run a small amount of ruby code before
343
- # exiting.
337
+ # process.
344
338
  #
345
339
  def exit: () -> Thread?
346
340
 
@@ -370,9 +364,9 @@ class Thread < Object
370
364
 
371
365
  # <!--
372
366
  # rdoc-file=thread.c
373
- # - Thread.new { ... } -> thread
374
- # - Thread.new(*args, &proc) -> thread
375
- # - Thread.new(*args) { |args| ... } -> thread
367
+ # - Thread.new { ... } -> thread
368
+ # - Thread.new(*args, &proc) -> thread
369
+ # - Thread.new(*args) { |args| ... } -> thread
376
370
  # -->
377
371
  # Creates a new thread executing the given block.
378
372
  #
@@ -666,10 +660,7 @@ class Thread < Object
666
660
  # <!-- rdoc-file=thread.c -->
667
661
  # Terminates `thr` and schedules another thread to be run, returning the
668
662
  # terminated Thread. If this is the main thread, or the last thread, exits the
669
- # process. Note that the caller does not wait for the thread to terminate if the
670
- # receiver is different from the currently running thread. The termination is
671
- # asynchronous, and the thread can still run a small amount of ruby code before
672
- # exiting.
663
+ # process.
673
664
  #
674
665
  def terminate: () -> Thread?
675
666
 
@@ -963,11 +954,12 @@ class Thread < Object
963
954
 
964
955
  # <!--
965
956
  # rdoc-file=thread.c
966
- # - raise(exception, message = exception.to_s, backtrace = nil, cause: $!)
967
- # - raise(message = nil, cause: $!)
957
+ # - thr.raise
958
+ # - thr.raise(string)
959
+ # - thr.raise(exception [, string [, array]])
968
960
  # -->
969
961
  # Raises an exception from the given thread. The caller does not have to be
970
- # `thr`. See Kernel#raise for more information on arguments.
962
+ # `thr`. See Kernel#raise for more information.
971
963
  #
972
964
  # Thread.abort_on_exception = true
973
965
  # a = Thread.new { sleep(200) }
@@ -980,8 +972,8 @@ class Thread < Object
980
972
  # from prog.rb:2:in `new'
981
973
  # from prog.rb:2
982
974
  #
983
- def raise: (?String message, ?cause: Exception?) -> nil
984
- | (_Exception, ?_ToS message, ?Array[Thread::Backtrace::Location] | Array[String] | nil backtrace, ?cause: Exception?) -> nil
975
+ def raise: (?String message) -> nil
976
+ | (_Exception, ?_ToS message, ?Array[Thread::Backtrace::Location] | Array[String] | nil backtrace) -> nil
985
977
 
986
978
  # <!--
987
979
  # rdoc-file=thread.c
@@ -1393,80 +1385,28 @@ end
1393
1385
  # <!-- rdoc-file=thread_sync.c -->
1394
1386
  # ConditionVariable objects augment class Mutex. Using condition variables, it
1395
1387
  # is possible to suspend while in the middle of a critical section until a
1396
- # condition is met, such as a resource becomes available.
1397
- #
1398
- # Due to non-deterministic scheduling and spurious wake-ups, users of condition
1399
- # variables should always use a separate boolean predicate (such as reading from
1400
- # a boolean variable) to check if the condition is actually met before starting
1401
- # to wait, and should wait in a loop, re-checking the condition every time the
1402
- # ConditionVariable is waken up. The idiomatic way of using condition variables
1403
- # is calling the `wait` method in an `until` loop with the predicate as the loop
1404
- # condition.
1405
- #
1406
- # condvar.wait(mutex) until condition_is_met
1407
- #
1408
- # In the example below, we use the boolean variable `resource_available` (which
1409
- # is protected by `mutex`) to indicate the availability of the resource, and use
1410
- # `condvar` to wait for that variable to become true. Note that:
1411
- #
1412
- # 1. Thread `b` may be scheduled before thread `a1` and `a2`, and may run so
1413
- # fast that it have already made the resource available before either `a1`
1414
- # or `a2` starts. Therefore, `a1` and `a2` should check if
1415
- # `resource_available` is already true before starting to wait.
1416
- # 2. The `wait` method may spuriously wake up without signalling. Therefore,
1417
- # thread `a1` and `a2` should recheck `resource_available` after the `wait`
1418
- # method returns, and go back to wait if the condition is not actually met.
1419
- # 3. It is possible that thread `a2` starts right after thread `a1` is waken up
1420
- # by `b`. Thread `a2` may have acquired the `mutex` and consumed the
1421
- # resource before thread `a1` acquires the `mutex`. This necessitates
1422
- # rechecking after `wait`, too.
1388
+ # resource becomes available.
1423
1389
  #
1424
1390
  # Example:
1425
1391
  #
1426
1392
  # mutex = Thread::Mutex.new
1393
+ # resource = Thread::ConditionVariable.new
1427
1394
  #
1428
- # resource_available = false
1429
- # condvar = Thread::ConditionVariable.new
1430
- #
1431
- # a1 = Thread.new {
1432
- # # Thread 'a1' waits for the resource to become available and consumes
1433
- # # the resource.
1434
- # mutex.synchronize {
1435
- # condvar.wait(mutex) until resource_available
1436
- # # After the loop, 'resource_available' is guaranteed to be true.
1437
- #
1438
- # resource_available = false
1439
- # puts "a1 consumed the resource"
1440
- # }
1441
- # }
1442
- #
1443
- # a2 = Thread.new {
1444
- # # Thread 'a2' behaves like 'a1'.
1445
- # mutex.synchronize {
1446
- # condvar.wait(mutex) until resource_available
1447
- # resource_available = false
1448
- # puts "a2 consumed the resource"
1449
- # }
1395
+ # a = Thread.new {
1396
+ # mutex.synchronize {
1397
+ # # Thread 'a' now needs the resource
1398
+ # resource.wait(mutex)
1399
+ # # 'a' can now have the resource
1400
+ # }
1450
1401
  # }
1451
1402
  #
1452
1403
  # b = Thread.new {
1453
- # # Thread 'b' periodically makes the resource available.
1454
- # loop {
1455
- # mutex.synchronize {
1456
- # resource_available = true
1457
- #
1458
- # # Notify one waiting thread if any. It is possible that neither
1459
- # # 'a1' nor 'a2 is waiting on 'condvar' at this moment. That's OK.
1460
- # condvar.signal
1461
- # }
1462
- # sleep 1
1463
- # }
1404
+ # mutex.synchronize {
1405
+ # # Thread 'b' has finished using the resource
1406
+ # resource.signal
1407
+ # }
1464
1408
  # }
1465
1409
  #
1466
- # # Eventually both 'a1' and 'a2' will have their resources, albeit in an
1467
- # # unspecified order.
1468
- # [a1, a2].each {|th| th.join}
1469
- #
1470
1410
  class Thread::ConditionVariable < Object
1471
1411
  # <!--
1472
1412
  # rdoc-file=thread_sync.c
@@ -1493,8 +1433,6 @@ class Thread::ConditionVariable < Object
1493
1433
  # If `timeout` is given, this method returns after `timeout` seconds passed,
1494
1434
  # even if no other thread doesn't signal.
1495
1435
  #
1496
- # This method may wake up spuriously due to underlying implementation details.
1497
- #
1498
1436
  # Returns the slept result on `mutex`.
1499
1437
  #
1500
1438
  def wait: (Thread::Mutex mutex, ?Time::_Timeout? timeout) -> Integer?
@@ -1522,7 +1460,7 @@ end
1522
1460
  #
1523
1461
  class Thread::Mutex < Object
1524
1462
  # <!--
1525
- # rdoc-file=thread_sync.rb
1463
+ # rdoc-file=thread_sync.c
1526
1464
  # - mutex.lock -> self
1527
1465
  # -->
1528
1466
  # Attempts to grab the lock and waits if it isn't available. Raises
@@ -1531,7 +1469,7 @@ class Thread::Mutex < Object
1531
1469
  def lock: () -> self
1532
1470
 
1533
1471
  # <!--
1534
- # rdoc-file=thread_sync.rb
1472
+ # rdoc-file=thread_sync.c
1535
1473
  # - mutex.locked? -> true or false
1536
1474
  # -->
1537
1475
  # Returns `true` if this lock is currently held by some thread.
@@ -1539,7 +1477,7 @@ class Thread::Mutex < Object
1539
1477
  def locked?: () -> bool
1540
1478
 
1541
1479
  # <!--
1542
- # rdoc-file=thread_sync.rb
1480
+ # rdoc-file=thread_sync.c
1543
1481
  # - mutex.owned? -> true or false
1544
1482
  # -->
1545
1483
  # Returns `true` if this lock is currently held by current thread.
@@ -1547,7 +1485,7 @@ class Thread::Mutex < Object
1547
1485
  def owned?: () -> bool
1548
1486
 
1549
1487
  # <!--
1550
- # rdoc-file=thread_sync.rb
1488
+ # rdoc-file=thread_sync.c
1551
1489
  # - mutex.synchronize { ... } -> result of the block
1552
1490
  # -->
1553
1491
  # Obtains a lock, runs the block, and releases the lock when the block
@@ -1556,7 +1494,7 @@ class Thread::Mutex < Object
1556
1494
  def synchronize: [X] () { () -> X } -> X
1557
1495
 
1558
1496
  # <!--
1559
- # rdoc-file=thread_sync.rb
1497
+ # rdoc-file=thread_sync.c
1560
1498
  # - mutex.try_lock -> true or false
1561
1499
  # -->
1562
1500
  # Attempts to obtain the lock and returns immediately. Returns `true` if the
@@ -1565,11 +1503,11 @@ class Thread::Mutex < Object
1565
1503
  def try_lock: () -> bool
1566
1504
 
1567
1505
  # <!--
1568
- # rdoc-file=thread_sync.rb
1569
- # - mutex.lock -> self
1506
+ # rdoc-file=thread_sync.c
1507
+ # - mutex.unlock -> self
1570
1508
  # -->
1571
- # Attempts to grab the lock and waits if it isn't available. Raises
1572
- # `ThreadError` if `mutex` was locked by the current thread.
1509
+ # Releases the lock. Raises `ThreadError` if `mutex` wasn't locked by the
1510
+ # current thread.
1573
1511
  #
1574
1512
  def unlock: () -> self
1575
1513
  end
data/core/time.rbs CHANGED
@@ -47,30 +47,24 @@
47
47
  #
48
48
  # ## Time Internal Representation
49
49
  #
50
- # Conceptually, Time class uses a rational value to represent the number of
51
- # seconds from *Epoch*, 1970-01-01 00:00:00 UTC. There are no boundary or
52
- # resolution limitations. The value can be obtained using Time#to_r.
53
- #
54
- # The Time class always uses the Gregorian calendar. I.e. the proleptic
55
- # Gregorian calendar is used. Other calendars, such as Julian calendar, are not
56
- # supported.
57
- #
58
- # The implementation uses a signed 63 bit integer, Integer (Bignum) object or
59
- # Ratoinal object to represent a rational value. (The signed 63 bit integer is
60
- # used regardless of 32 and 64 bit environments.) The value represents the
61
- # number of nanoseconds from *Epoch*. The signed 63 bit integer can represent
62
- # 1823-11-12 to 2116-02-20. When Integer or Rational object is used (before
50
+ # Time implementation uses a signed 63 bit integer, Integer, or Rational. It is
51
+ # a number of nanoseconds since the *Epoch*. The signed 63 bit integer can
52
+ # represent 1823-11-12 to 2116-02-20. When Integer or Rational is used (before
63
53
  # 1823, after 2116, under nanosecond), Time works slower than when the signed 63
64
54
  # bit integer is used.
65
55
  #
66
56
  # Ruby uses the C function `localtime` and `gmtime` to map between the number
67
57
  # and 6-tuple (year,month,day,hour,minute,second). `localtime` is used for local
68
- # time and `gmtime` is used for UTC.
58
+ # time and "gmtime" is used for UTC.
69
59
  #
70
60
  # Integer and Rational has no range limit, but the localtime and gmtime has
71
61
  # range limits due to the C types `time_t` and `struct tm`. If that limit is
72
62
  # exceeded, Ruby extrapolates the localtime function.
73
63
  #
64
+ # The Time class always uses the Gregorian calendar. I.e. the proleptic
65
+ # Gregorian calendar is used. Other calendars, such as Julian calendar, are not
66
+ # supported.
67
+ #
74
68
  # `time_t` can represent 1901-12-14 to 2038-01-19 if it is 32 bit signed
75
69
  # integer, -292277022657-01-27 to 292277026596-12-05 if it is 64 bit signed
76
70
  # integer. However `localtime` on some platforms doesn't supports negative
@@ -78,7 +72,7 @@
78
72
  #
79
73
  # `struct tm` has *tm_year* member to represent years. (`tm_year = 0` means the
80
74
  # year 1900.) It is defined as `int` in the C standard. *tm_year* can represent
81
- # years between -2147481748 to 2147485547 if `int` is 32 bit.
75
+ # between -2147481748 to 2147485547 if `int` is 32 bit.
82
76
  #
83
77
  # Ruby supports leap seconds as far as if the C function `localtime` and
84
78
  # `gmtime` supports it. They use the tz database in most Unix systems. The tz
@@ -990,20 +984,10 @@ class Time < Object
990
984
  # now = Time.now
991
985
  # # => 2022-08-18 10:24:13.5398485 -0500
992
986
  # now.utc? # => false
993
- # now.getutc.utc? # => true
994
987
  # utc = Time.utc(2000, 1, 1, 20, 15, 1)
995
988
  # # => 2000-01-01 20:15:01 UTC
996
989
  # utc.utc? # => true
997
990
  #
998
- # `Time` objects created with these methods are considered to be in UTC:
999
- #
1000
- # * Time.utc
1001
- # * Time#utc
1002
- # * Time#getutc
1003
- #
1004
- # Objects created in other ways will not be treated as UTC even if the
1005
- # environment variable "TZ" is "UTC".
1006
- #
1007
991
  # Related: Time.utc.
1008
992
  #
1009
993
  def gmt?: () -> bool
@@ -1576,20 +1560,10 @@ class Time < Object
1576
1560
  # now = Time.now
1577
1561
  # # => 2022-08-18 10:24:13.5398485 -0500
1578
1562
  # now.utc? # => false
1579
- # now.getutc.utc? # => true
1580
1563
  # utc = Time.utc(2000, 1, 1, 20, 15, 1)
1581
1564
  # # => 2000-01-01 20:15:01 UTC
1582
1565
  # utc.utc? # => true
1583
1566
  #
1584
- # `Time` objects created with these methods are considered to be in UTC:
1585
- #
1586
- # * Time.utc
1587
- # * Time#utc
1588
- # * Time#getutc
1589
- #
1590
- # Objects created in other ways will not be treated as UTC even if the
1591
- # environment variable "TZ" is "UTC".
1592
- #
1593
1567
  # Related: Time.utc.
1594
1568
  #
1595
1569
  def utc?: () -> bool
data/core/trace_point.rbs CHANGED
@@ -25,8 +25,7 @@
25
25
  # change. Instead, it is recommended to specify the types of events you want to
26
26
  # use.
27
27
  #
28
- # To filter what is traced, you can pass any number of the following as
29
- # `events`:
28
+ # To filter what is traced, you can pass any of the following as `events`:
30
29
  #
31
30
  # `:line`
32
31
  # : Execute an expression or statement on a new line.
@@ -108,8 +107,8 @@ class TracePoint
108
107
  #
109
108
  # A block must be given; otherwise, an ArgumentError is raised.
110
109
  #
111
- # If the trace method isn't supported for the given event(s) filter, a
112
- # RuntimeError is raised.
110
+ # If the trace method isn't included in the given events filter, a RuntimeError
111
+ # is raised.
113
112
  #
114
113
  # TracePoint.trace(:line) do |tp|
115
114
  # p tp.raised_exception
@@ -123,9 +122,7 @@ class TracePoint
123
122
  # end
124
123
  # $tp.lineno #=> access from outside (RuntimeError)
125
124
  #
126
- # Access from other ractors, threads or fibers is forbidden. TracePoints are
127
- # active per-ractor so if you enable a TracePoint in one ractor, other ractors
128
- # will not be affected.
125
+ # Access from other threads is also forbidden.
129
126
  #
130
127
  def self.new: (*_ToSym events) { (instance tp) -> void } -> instance
131
128
 
@@ -1,5 +1,5 @@
1
1
  # <!-- rdoc-file=proc.c -->
2
- # Ruby supports two forms of objectified methods. Class `Method` is used to
2
+ # Ruby supports two forms of objectified methods. Class Method is used to
3
3
  # represent methods that are associated with a particular object: these method
4
4
  # objects are bound to that object. Bound method objects for an object can be
5
5
  # created using Object#method.
@@ -287,18 +287,10 @@ class UnboundMethod
287
287
 
288
288
  # <!--
289
289
  # rdoc-file=proc.c
290
- # - meth.source_location -> [String, Integer, Integer, Integer, Integer]
290
+ # - meth.source_location -> [String, Integer]
291
291
  # -->
292
- # Returns the location where the method was defined. The returned Array
293
- # contains:
294
- # (1) the Ruby source filename
295
- # (2) the line number where the definition starts
296
- # (3) the column number where the definition starts
297
- # (4) the line number where the definition ends
298
- # (5) the column number where the definitions ends
299
- #
300
- # This method will return `nil` if the method was not defined in Ruby (i.e.
301
- # native).
292
+ # Returns the Ruby source filename and line number containing this method or nil
293
+ # if this method was not defined in Ruby (i.e. native).
302
294
  #
303
295
  def source_location: () -> [String, Integer]?
304
296
 
@@ -306,8 +298,8 @@ class UnboundMethod
306
298
  # rdoc-file=proc.c
307
299
  # - meth.super_method -> method
308
300
  # -->
309
- # Returns a `Method` of superclass which would be called when super is used or
310
- # nil if there is no method on superclass.
301
+ # Returns a Method of superclass which would be called when super is used or nil
302
+ # if there is no method on superclass.
311
303
  #
312
304
  def super_method: () -> UnboundMethod?
313
305
 
data/docs/collection.md CHANGED
@@ -159,9 +159,9 @@ For example:
159
159
  # manifest.yaml
160
160
 
161
161
  dependencies:
162
- # If your gem depends on logger but the gemspec doesn't include logger,
162
+ # If your gem depends on pathname but the gemspec doesn't include pathname,
163
163
  # you need to write the following.
164
- - name: logger
164
+ - name: pathname
165
165
  ```
166
166
 
167
167
  If the gem's RBS is managed with [ruby/gem_rbs_collection](https://github.com/ruby/gem_rbs_collection), put it as `gems/GEM_NAME/VERSION/manifest.yaml`. For example, `gems/activesupport/6.0/manifest.yaml`.
data/docs/gem.md CHANGED
@@ -34,6 +34,7 @@ dependencies:
34
34
  - name: json
35
35
  - name: logger
36
36
  - name: optparse
37
+ - name: pathname
37
38
  - name: rdoc
38
39
  - name: tsort
39
40
  ```
data/docs/sigs.md CHANGED
@@ -131,10 +131,10 @@ You may need to specify `-r` or `-I` to load signatures.
131
131
  The default is `-I sig`.
132
132
 
133
133
  ```shell
134
- RBS_TEST_OPT='-r logger -I sig'
134
+ RBS_TEST_OPT='-r pathname -I sig'
135
135
  ```
136
136
 
137
- Replacing `logger` with the `stdlib` you want to include. For example, if you need to load `Set` and `BigDecimal` in `stdlib`, you would need to have `RBS_TEST_OPT='-r set -r bigdecimal -I sig'`
137
+ Replacing `pathname` with the `stdlib` you want to include. For example, if you need to load `Set` and `BigDecimal` in `stdlib`, you would need to have `RBS_TEST_OPT='-r set -r bigdecimal -I sig'`
138
138
 
139
139
  `RBS_TEST_LOGLEVEL` can be used to configure log level. Defaults to `info`.
140
140
 
@@ -148,7 +148,7 @@ So, a typical command line to start the test would look like the following:
148
148
  $ RBS_TEST_LOGLEVEL=error \
149
149
  RBS_TEST_TARGET='Kaigi::*' \
150
150
  RBS_TEST_SKIP='Kaigi::MonkeyPatch' \
151
- RBS_TEST_OPT='-rlogger -Isig -Iprivate' \
151
+ RBS_TEST_OPT='-rset -rpathname -Isig -Iprivate' \
152
152
  RBS_TEST_RAISE=true \
153
153
  RUBYOPT='-rbundler/setup -rrbs/test/setup' \
154
154
  bundle exec rake test