rbs 3.10.0 → 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 (202) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +3 -3
  3. data/.github/workflows/ruby.yml +24 -35
  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 -88
  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 -100
  13. data/core/complex.rbs +21 -32
  14. data/core/dir.rbs +2 -2
  15. data/core/encoding.rbs +9 -6
  16. data/core/enumerable.rbs +3 -90
  17. data/core/enumerator.rbs +1 -18
  18. data/core/errno.rbs +0 -8
  19. data/core/errors.rbs +1 -28
  20. data/core/exception.rbs +2 -2
  21. data/core/fiber.rbs +4 -5
  22. data/core/file.rbs +12 -27
  23. data/core/file_test.rbs +1 -1
  24. data/core/float.rbs +22 -209
  25. data/core/gc.rbs +281 -417
  26. data/core/hash.rbs +727 -1024
  27. data/core/integer.rbs +38 -78
  28. data/core/io/buffer.rbs +7 -18
  29. data/core/io/wait.rbs +33 -11
  30. data/core/io.rbs +12 -14
  31. data/core/kernel.rbs +51 -57
  32. data/core/marshal.rbs +1 -1
  33. data/core/match_data.rbs +1 -1
  34. data/core/math.rbs +3 -42
  35. data/core/method.rbs +6 -14
  36. data/core/module.rbs +17 -88
  37. data/core/nil_class.rbs +3 -3
  38. data/core/numeric.rbs +16 -16
  39. data/core/object.rbs +3 -3
  40. data/core/object_space.rbs +15 -21
  41. data/core/proc.rbs +8 -15
  42. data/core/process.rbs +2 -2
  43. data/core/ractor.rbs +437 -278
  44. data/core/range.rbs +8 -7
  45. data/core/rational.rbs +24 -37
  46. data/core/rbs/unnamed/argf.rbs +2 -2
  47. data/core/rbs/unnamed/env_class.rbs +1 -1
  48. data/core/rbs/unnamed/random.rbs +2 -4
  49. data/core/regexp.rbs +20 -25
  50. data/core/ruby_vm.rbs +4 -6
  51. data/core/rubygems/errors.rbs +70 -3
  52. data/core/rubygems/rubygems.rbs +79 -11
  53. data/core/rubygems/version.rbs +3 -2
  54. data/core/set.rbs +359 -488
  55. data/core/string.rbs +1228 -3153
  56. data/core/struct.rbs +1 -1
  57. data/core/symbol.rbs +4 -4
  58. data/core/thread.rbs +29 -92
  59. data/core/time.rbs +9 -35
  60. data/core/trace_point.rbs +4 -7
  61. data/core/unbound_method.rbs +6 -14
  62. data/docs/collection.md +2 -2
  63. data/docs/gem.md +1 -0
  64. data/docs/sigs.md +3 -3
  65. data/ext/rbs_extension/ast_translation.c +1077 -944
  66. data/ext/rbs_extension/ast_translation.h +0 -7
  67. data/ext/rbs_extension/class_constants.c +83 -71
  68. data/ext/rbs_extension/class_constants.h +7 -4
  69. data/ext/rbs_extension/extconf.rb +2 -24
  70. data/ext/rbs_extension/legacy_location.c +172 -173
  71. data/ext/rbs_extension/legacy_location.h +3 -8
  72. data/ext/rbs_extension/main.c +289 -239
  73. data/ext/rbs_extension/rbs_extension.h +0 -3
  74. data/ext/rbs_extension/rbs_string_bridging.h +0 -4
  75. data/include/rbs/ast.h +98 -37
  76. data/include/rbs/defines.h +12 -38
  77. data/include/rbs/lexer.h +114 -126
  78. data/include/rbs/location.h +14 -14
  79. data/include/rbs/parser.h +37 -21
  80. data/include/rbs/string.h +5 -3
  81. data/include/rbs/util/rbs_allocator.h +19 -40
  82. data/include/rbs/util/rbs_assert.h +1 -12
  83. data/include/rbs/util/rbs_constant_pool.h +3 -3
  84. data/include/rbs/util/rbs_encoding.h +1 -3
  85. data/include/rbs/util/rbs_unescape.h +1 -2
  86. data/lib/rbs/ast/ruby/annotations.rb +119 -0
  87. data/lib/rbs/ast/ruby/comment_block.rb +221 -0
  88. data/lib/rbs/ast/ruby/declarations.rb +86 -0
  89. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +24 -0
  90. data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
  91. data/lib/rbs/ast/ruby/members.rb +213 -0
  92. data/lib/rbs/buffer.rb +104 -24
  93. data/lib/rbs/cli/validate.rb +40 -35
  94. data/lib/rbs/cli.rb +5 -6
  95. data/lib/rbs/collection/config/lockfile_generator.rb +0 -1
  96. data/lib/rbs/collection.rb +0 -1
  97. data/lib/rbs/definition.rb +6 -1
  98. data/lib/rbs/definition_builder/ancestor_builder.rb +65 -62
  99. data/lib/rbs/definition_builder/method_builder.rb +45 -30
  100. data/lib/rbs/definition_builder.rb +44 -9
  101. data/lib/rbs/environment/class_entry.rb +69 -0
  102. data/lib/rbs/environment/module_entry.rb +66 -0
  103. data/lib/rbs/environment.rb +244 -218
  104. data/lib/rbs/environment_loader.rb +3 -3
  105. data/lib/rbs/errors.rb +5 -4
  106. data/lib/rbs/inline_parser/comment_association.rb +117 -0
  107. data/lib/rbs/inline_parser.rb +206 -0
  108. data/lib/rbs/location_aux.rb +35 -3
  109. data/lib/rbs/parser_aux.rb +11 -6
  110. data/lib/rbs/prototype/runtime.rb +2 -2
  111. data/lib/rbs/resolver/constant_resolver.rb +2 -2
  112. data/lib/rbs/resolver/type_name_resolver.rb +38 -124
  113. data/lib/rbs/source.rb +99 -0
  114. data/lib/rbs/subtractor.rb +4 -3
  115. data/lib/rbs/test/type_check.rb +0 -14
  116. data/lib/rbs/types.rb +1 -3
  117. data/lib/rbs/version.rb +1 -1
  118. data/lib/rbs.rb +13 -1
  119. data/lib/rdoc/discover.rb +1 -1
  120. data/lib/rdoc_plugin/parser.rb +1 -1
  121. data/rbs.gemspec +1 -0
  122. data/sig/ancestor_builder.rbs +1 -1
  123. data/sig/ast/ruby/annotations.rbs +110 -0
  124. data/sig/ast/ruby/comment_block.rbs +119 -0
  125. data/sig/ast/ruby/declarations.rbs +60 -0
  126. data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
  127. data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
  128. data/sig/ast/ruby/members.rbs +72 -0
  129. data/sig/buffer.rbs +63 -5
  130. data/sig/definition.rbs +1 -0
  131. data/sig/definition_builder.rbs +1 -1
  132. data/sig/environment/class_entry.rbs +50 -0
  133. data/sig/environment/module_entry.rbs +50 -0
  134. data/sig/environment.rbs +28 -133
  135. data/sig/errors.rbs +13 -6
  136. data/sig/inline_parser/comment_association.rbs +71 -0
  137. data/sig/inline_parser.rbs +87 -0
  138. data/sig/location.rbs +32 -7
  139. data/sig/manifest.yaml +1 -0
  140. data/sig/method_builder.rbs +7 -4
  141. data/sig/parser.rbs +16 -20
  142. data/sig/resolver/type_name_resolver.rbs +7 -38
  143. data/sig/source.rbs +48 -0
  144. data/sig/types.rbs +1 -4
  145. data/src/ast.c +290 -201
  146. data/src/lexer.c +2813 -2902
  147. data/src/lexer.re +4 -0
  148. data/src/lexstate.c +155 -169
  149. data/src/location.c +40 -40
  150. data/src/parser.c +2665 -2433
  151. data/src/string.c +48 -0
  152. data/src/util/rbs_allocator.c +77 -80
  153. data/src/util/rbs_assert.c +10 -10
  154. data/src/util/rbs_buffer.c +2 -2
  155. data/src/util/rbs_constant_pool.c +15 -13
  156. data/src/util/rbs_encoding.c +4062 -20097
  157. data/src/util/rbs_unescape.c +48 -85
  158. data/stdlib/bigdecimal/0/big_decimal.rbs +82 -100
  159. data/stdlib/bigdecimal-math/0/big_math.rbs +8 -169
  160. data/stdlib/cgi/0/core.rbs +396 -2
  161. data/stdlib/cgi/0/manifest.yaml +0 -1
  162. data/stdlib/coverage/0/coverage.rbs +1 -3
  163. data/stdlib/date/0/date.rbs +59 -67
  164. data/stdlib/date/0/date_time.rbs +1 -1
  165. data/stdlib/delegate/0/delegator.rbs +7 -10
  166. data/stdlib/erb/0/erb.rbs +347 -737
  167. data/stdlib/fileutils/0/fileutils.rbs +13 -18
  168. data/stdlib/forwardable/0/forwardable.rbs +0 -3
  169. data/stdlib/json/0/json.rbs +48 -68
  170. data/stdlib/net-http/0/net-http.rbs +0 -3
  171. data/stdlib/objspace/0/objspace.rbs +4 -9
  172. data/stdlib/open-uri/0/open-uri.rbs +0 -40
  173. data/stdlib/openssl/0/openssl.rbs +228 -331
  174. data/stdlib/optparse/0/optparse.rbs +3 -3
  175. data/{core → stdlib/pathname/0}/pathname.rbs +355 -255
  176. data/stdlib/psych/0/psych.rbs +3 -3
  177. data/stdlib/rdoc/0/rdoc.rbs +1 -1
  178. data/stdlib/resolv/0/resolv.rbs +68 -25
  179. data/stdlib/ripper/0/ripper.rbs +2 -5
  180. data/stdlib/singleton/0/singleton.rbs +0 -3
  181. data/stdlib/socket/0/socket.rbs +1 -13
  182. data/stdlib/socket/0/tcp_socket.rbs +2 -10
  183. data/stdlib/stringio/0/stringio.rbs +85 -1176
  184. data/stdlib/strscan/0/string_scanner.rbs +31 -31
  185. data/stdlib/tempfile/0/tempfile.rbs +3 -3
  186. data/stdlib/time/0/time.rbs +1 -1
  187. data/stdlib/timeout/0/timeout.rbs +7 -63
  188. data/stdlib/tsort/0/cyclic.rbs +0 -3
  189. data/stdlib/uri/0/common.rbs +2 -11
  190. data/stdlib/uri/0/file.rbs +1 -1
  191. data/stdlib/uri/0/generic.rbs +16 -17
  192. data/stdlib/uri/0/rfc2396_parser.rbs +7 -6
  193. data/stdlib/zlib/0/zstream.rbs +0 -1
  194. metadata +40 -12
  195. data/.clang-format +0 -74
  196. data/.clangd +0 -2
  197. data/.github/workflows/c-check.yml +0 -54
  198. data/core/ruby.rbs +0 -53
  199. data/docs/aliases.md +0 -79
  200. data/docs/encoding.md +0 -56
  201. data/ext/rbs_extension/compat.h +0 -10
  202. data/stdlib/cgi-escape/0/escape.rbs +0 -153
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
@@ -188,7 +188,7 @@ class Symbol
188
188
 
189
189
  # <!--
190
190
  # rdoc-file=string.c
191
- # - capitalize(mapping) -> symbol
191
+ # - capitalize(*options) -> symbol
192
192
  # -->
193
193
  # Equivalent to `sym.to_s.capitalize.to_sym`.
194
194
  #
@@ -268,7 +268,7 @@ class Symbol
268
268
 
269
269
  # <!--
270
270
  # rdoc-file=string.c
271
- # - downcase(mapping) -> symbol
271
+ # - downcase(*options) -> symbol
272
272
  # -->
273
273
  # Equivalent to `sym.to_s.downcase.to_sym`.
274
274
  #
@@ -413,7 +413,7 @@ class Symbol
413
413
 
414
414
  # <!--
415
415
  # rdoc-file=string.c
416
- # - swapcase(mapping) -> symbol
416
+ # - swapcase(*options) -> symbol
417
417
  # -->
418
418
  # Equivalent to `sym.to_s.swapcase.to_sym`.
419
419
  #
@@ -462,7 +462,7 @@ class Symbol
462
462
 
463
463
  # <!--
464
464
  # rdoc-file=string.c
465
- # - upcase(mapping) -> symbol
465
+ # - upcase(*options) -> symbol
466
466
  # -->
467
467
  # Equivalent to `sym.to_s.upcase.to_sym`.
468
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
 
@@ -981,8 +972,8 @@ class Thread < Object
981
972
  # from prog.rb:2:in `new'
982
973
  # from prog.rb:2
983
974
  #
984
- def raise: (?String message, ?cause: Exception?) -> nil
985
- | (_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
986
977
 
987
978
  # <!--
988
979
  # rdoc-file=thread.c
@@ -1394,80 +1385,28 @@ end
1394
1385
  # <!-- rdoc-file=thread_sync.c -->
1395
1386
  # ConditionVariable objects augment class Mutex. Using condition variables, it
1396
1387
  # is possible to suspend while in the middle of a critical section until a
1397
- # condition is met, such as a resource becomes available.
1398
- #
1399
- # Due to non-deterministic scheduling and spurious wake-ups, users of condition
1400
- # variables should always use a separate boolean predicate (such as reading from
1401
- # a boolean variable) to check if the condition is actually met before starting
1402
- # to wait, and should wait in a loop, re-checking the condition every time the
1403
- # ConditionVariable is waken up. The idiomatic way of using condition variables
1404
- # is calling the `wait` method in an `until` loop with the predicate as the loop
1405
- # condition.
1406
- #
1407
- # condvar.wait(mutex) until condition_is_met
1408
- #
1409
- # In the example below, we use the boolean variable `resource_available` (which
1410
- # is protected by `mutex`) to indicate the availability of the resource, and use
1411
- # `condvar` to wait for that variable to become true. Note that:
1412
- #
1413
- # 1. Thread `b` may be scheduled before thread `a1` and `a2`, and may run so
1414
- # fast that it have already made the resource available before either `a1`
1415
- # or `a2` starts. Therefore, `a1` and `a2` should check if
1416
- # `resource_available` is already true before starting to wait.
1417
- # 2. The `wait` method may spuriously wake up without signalling. Therefore,
1418
- # thread `a1` and `a2` should recheck `resource_available` after the `wait`
1419
- # method returns, and go back to wait if the condition is not actually met.
1420
- # 3. It is possible that thread `a2` starts right after thread `a1` is waken up
1421
- # by `b`. Thread `a2` may have acquired the `mutex` and consumed the
1422
- # resource before thread `a1` acquires the `mutex`. This necessitates
1423
- # rechecking after `wait`, too.
1388
+ # resource becomes available.
1424
1389
  #
1425
1390
  # Example:
1426
1391
  #
1427
1392
  # mutex = Thread::Mutex.new
1393
+ # resource = Thread::ConditionVariable.new
1428
1394
  #
1429
- # resource_available = false
1430
- # condvar = Thread::ConditionVariable.new
1431
- #
1432
- # a1 = Thread.new {
1433
- # # Thread 'a1' waits for the resource to become available and consumes
1434
- # # the resource.
1435
- # mutex.synchronize {
1436
- # condvar.wait(mutex) until resource_available
1437
- # # After the loop, 'resource_available' is guaranteed to be true.
1438
- #
1439
- # resource_available = false
1440
- # puts "a1 consumed the resource"
1441
- # }
1442
- # }
1443
- #
1444
- # a2 = Thread.new {
1445
- # # Thread 'a2' behaves like 'a1'.
1446
- # mutex.synchronize {
1447
- # condvar.wait(mutex) until resource_available
1448
- # resource_available = false
1449
- # puts "a2 consumed the resource"
1450
- # }
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
+ # }
1451
1401
  # }
1452
1402
  #
1453
1403
  # b = Thread.new {
1454
- # # Thread 'b' periodically makes the resource available.
1455
- # loop {
1456
- # mutex.synchronize {
1457
- # resource_available = true
1458
- #
1459
- # # Notify one waiting thread if any. It is possible that neither
1460
- # # 'a1' nor 'a2 is waiting on 'condvar' at this moment. That's OK.
1461
- # condvar.signal
1462
- # }
1463
- # sleep 1
1464
- # }
1404
+ # mutex.synchronize {
1405
+ # # Thread 'b' has finished using the resource
1406
+ # resource.signal
1407
+ # }
1465
1408
  # }
1466
1409
  #
1467
- # # Eventually both 'a1' and 'a2' will have their resources, albeit in an
1468
- # # unspecified order.
1469
- # [a1, a2].each {|th| th.join}
1470
- #
1471
1410
  class Thread::ConditionVariable < Object
1472
1411
  # <!--
1473
1412
  # rdoc-file=thread_sync.c
@@ -1494,8 +1433,6 @@ class Thread::ConditionVariable < Object
1494
1433
  # If `timeout` is given, this method returns after `timeout` seconds passed,
1495
1434
  # even if no other thread doesn't signal.
1496
1435
  #
1497
- # This method may wake up spuriously due to underlying implementation details.
1498
- #
1499
1436
  # Returns the slept result on `mutex`.
1500
1437
  #
1501
1438
  def wait: (Thread::Mutex mutex, ?Time::_Timeout? timeout) -> Integer?
@@ -1523,7 +1460,7 @@ end
1523
1460
  #
1524
1461
  class Thread::Mutex < Object
1525
1462
  # <!--
1526
- # rdoc-file=thread_sync.rb
1463
+ # rdoc-file=thread_sync.c
1527
1464
  # - mutex.lock -> self
1528
1465
  # -->
1529
1466
  # Attempts to grab the lock and waits if it isn't available. Raises
@@ -1532,7 +1469,7 @@ class Thread::Mutex < Object
1532
1469
  def lock: () -> self
1533
1470
 
1534
1471
  # <!--
1535
- # rdoc-file=thread_sync.rb
1472
+ # rdoc-file=thread_sync.c
1536
1473
  # - mutex.locked? -> true or false
1537
1474
  # -->
1538
1475
  # Returns `true` if this lock is currently held by some thread.
@@ -1540,7 +1477,7 @@ class Thread::Mutex < Object
1540
1477
  def locked?: () -> bool
1541
1478
 
1542
1479
  # <!--
1543
- # rdoc-file=thread_sync.rb
1480
+ # rdoc-file=thread_sync.c
1544
1481
  # - mutex.owned? -> true or false
1545
1482
  # -->
1546
1483
  # Returns `true` if this lock is currently held by current thread.
@@ -1548,7 +1485,7 @@ class Thread::Mutex < Object
1548
1485
  def owned?: () -> bool
1549
1486
 
1550
1487
  # <!--
1551
- # rdoc-file=thread_sync.rb
1488
+ # rdoc-file=thread_sync.c
1552
1489
  # - mutex.synchronize { ... } -> result of the block
1553
1490
  # -->
1554
1491
  # Obtains a lock, runs the block, and releases the lock when the block
@@ -1557,7 +1494,7 @@ class Thread::Mutex < Object
1557
1494
  def synchronize: [X] () { () -> X } -> X
1558
1495
 
1559
1496
  # <!--
1560
- # rdoc-file=thread_sync.rb
1497
+ # rdoc-file=thread_sync.c
1561
1498
  # - mutex.try_lock -> true or false
1562
1499
  # -->
1563
1500
  # Attempts to obtain the lock and returns immediately. Returns `true` if the
@@ -1566,11 +1503,11 @@ class Thread::Mutex < Object
1566
1503
  def try_lock: () -> bool
1567
1504
 
1568
1505
  # <!--
1569
- # rdoc-file=thread_sync.rb
1570
- # - mutex.lock -> self
1506
+ # rdoc-file=thread_sync.c
1507
+ # - mutex.unlock -> self
1571
1508
  # -->
1572
- # Attempts to grab the lock and waits if it isn't available. Raises
1573
- # `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.
1574
1511
  #
1575
1512
  def unlock: () -> self
1576
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