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.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +3 -3
- data/.github/workflows/ruby.yml +24 -35
- data/.github/workflows/typecheck.yml +3 -1
- data/.github/workflows/windows.yml +2 -2
- data/.gitignore +0 -4
- data/CHANGELOG.md +0 -88
- data/README.md +1 -38
- data/Rakefile +20 -142
- data/Steepfile +1 -0
- data/config.yml +43 -1
- data/core/array.rbs +46 -100
- data/core/complex.rbs +21 -32
- data/core/dir.rbs +2 -2
- data/core/encoding.rbs +9 -6
- data/core/enumerable.rbs +3 -90
- data/core/enumerator.rbs +1 -18
- data/core/errno.rbs +0 -8
- data/core/errors.rbs +1 -28
- data/core/exception.rbs +2 -2
- data/core/fiber.rbs +4 -5
- data/core/file.rbs +12 -27
- data/core/file_test.rbs +1 -1
- data/core/float.rbs +22 -209
- data/core/gc.rbs +281 -417
- data/core/hash.rbs +727 -1024
- data/core/integer.rbs +38 -78
- data/core/io/buffer.rbs +7 -18
- data/core/io/wait.rbs +33 -11
- data/core/io.rbs +12 -14
- data/core/kernel.rbs +51 -57
- data/core/marshal.rbs +1 -1
- data/core/match_data.rbs +1 -1
- data/core/math.rbs +3 -42
- data/core/method.rbs +6 -14
- data/core/module.rbs +17 -88
- data/core/nil_class.rbs +3 -3
- data/core/numeric.rbs +16 -16
- data/core/object.rbs +3 -3
- data/core/object_space.rbs +15 -21
- data/core/proc.rbs +8 -15
- data/core/process.rbs +2 -2
- data/core/ractor.rbs +437 -278
- data/core/range.rbs +8 -7
- data/core/rational.rbs +24 -37
- data/core/rbs/unnamed/argf.rbs +2 -2
- data/core/rbs/unnamed/env_class.rbs +1 -1
- data/core/rbs/unnamed/random.rbs +2 -4
- data/core/regexp.rbs +20 -25
- data/core/ruby_vm.rbs +4 -6
- data/core/rubygems/errors.rbs +70 -3
- data/core/rubygems/rubygems.rbs +79 -11
- data/core/rubygems/version.rbs +3 -2
- data/core/set.rbs +359 -488
- data/core/string.rbs +1228 -3153
- data/core/struct.rbs +1 -1
- data/core/symbol.rbs +4 -4
- data/core/thread.rbs +29 -92
- data/core/time.rbs +9 -35
- data/core/trace_point.rbs +4 -7
- data/core/unbound_method.rbs +6 -14
- data/docs/collection.md +2 -2
- data/docs/gem.md +1 -0
- data/docs/sigs.md +3 -3
- data/ext/rbs_extension/ast_translation.c +1077 -944
- data/ext/rbs_extension/ast_translation.h +0 -7
- data/ext/rbs_extension/class_constants.c +83 -71
- data/ext/rbs_extension/class_constants.h +7 -4
- data/ext/rbs_extension/extconf.rb +2 -24
- data/ext/rbs_extension/legacy_location.c +172 -173
- data/ext/rbs_extension/legacy_location.h +3 -8
- data/ext/rbs_extension/main.c +289 -239
- data/ext/rbs_extension/rbs_extension.h +0 -3
- data/ext/rbs_extension/rbs_string_bridging.h +0 -4
- data/include/rbs/ast.h +98 -37
- data/include/rbs/defines.h +12 -38
- data/include/rbs/lexer.h +114 -126
- data/include/rbs/location.h +14 -14
- data/include/rbs/parser.h +37 -21
- data/include/rbs/string.h +5 -3
- data/include/rbs/util/rbs_allocator.h +19 -40
- data/include/rbs/util/rbs_assert.h +1 -12
- data/include/rbs/util/rbs_constant_pool.h +3 -3
- data/include/rbs/util/rbs_encoding.h +1 -3
- data/include/rbs/util/rbs_unescape.h +1 -2
- data/lib/rbs/ast/ruby/annotations.rb +119 -0
- data/lib/rbs/ast/ruby/comment_block.rb +221 -0
- data/lib/rbs/ast/ruby/declarations.rb +86 -0
- data/lib/rbs/ast/ruby/helpers/constant_helper.rb +24 -0
- data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
- data/lib/rbs/ast/ruby/members.rb +213 -0
- data/lib/rbs/buffer.rb +104 -24
- data/lib/rbs/cli/validate.rb +40 -35
- data/lib/rbs/cli.rb +5 -6
- data/lib/rbs/collection/config/lockfile_generator.rb +0 -1
- data/lib/rbs/collection.rb +0 -1
- data/lib/rbs/definition.rb +6 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +65 -62
- data/lib/rbs/definition_builder/method_builder.rb +45 -30
- data/lib/rbs/definition_builder.rb +44 -9
- data/lib/rbs/environment/class_entry.rb +69 -0
- data/lib/rbs/environment/module_entry.rb +66 -0
- data/lib/rbs/environment.rb +244 -218
- data/lib/rbs/environment_loader.rb +3 -3
- data/lib/rbs/errors.rb +5 -4
- data/lib/rbs/inline_parser/comment_association.rb +117 -0
- data/lib/rbs/inline_parser.rb +206 -0
- data/lib/rbs/location_aux.rb +35 -3
- data/lib/rbs/parser_aux.rb +11 -6
- data/lib/rbs/prototype/runtime.rb +2 -2
- data/lib/rbs/resolver/constant_resolver.rb +2 -2
- data/lib/rbs/resolver/type_name_resolver.rb +38 -124
- data/lib/rbs/source.rb +99 -0
- data/lib/rbs/subtractor.rb +4 -3
- data/lib/rbs/test/type_check.rb +0 -14
- data/lib/rbs/types.rb +1 -3
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +13 -1
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +1 -1
- data/rbs.gemspec +1 -0
- data/sig/ancestor_builder.rbs +1 -1
- data/sig/ast/ruby/annotations.rbs +110 -0
- data/sig/ast/ruby/comment_block.rbs +119 -0
- data/sig/ast/ruby/declarations.rbs +60 -0
- data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
- data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
- data/sig/ast/ruby/members.rbs +72 -0
- data/sig/buffer.rbs +63 -5
- data/sig/definition.rbs +1 -0
- data/sig/definition_builder.rbs +1 -1
- data/sig/environment/class_entry.rbs +50 -0
- data/sig/environment/module_entry.rbs +50 -0
- data/sig/environment.rbs +28 -133
- data/sig/errors.rbs +13 -6
- data/sig/inline_parser/comment_association.rbs +71 -0
- data/sig/inline_parser.rbs +87 -0
- data/sig/location.rbs +32 -7
- data/sig/manifest.yaml +1 -0
- data/sig/method_builder.rbs +7 -4
- data/sig/parser.rbs +16 -20
- data/sig/resolver/type_name_resolver.rbs +7 -38
- data/sig/source.rbs +48 -0
- data/sig/types.rbs +1 -4
- data/src/ast.c +290 -201
- data/src/lexer.c +2813 -2902
- data/src/lexer.re +4 -0
- data/src/lexstate.c +155 -169
- data/src/location.c +40 -40
- data/src/parser.c +2665 -2433
- data/src/string.c +48 -0
- data/src/util/rbs_allocator.c +77 -80
- data/src/util/rbs_assert.c +10 -10
- data/src/util/rbs_buffer.c +2 -2
- data/src/util/rbs_constant_pool.c +15 -13
- data/src/util/rbs_encoding.c +4062 -20097
- data/src/util/rbs_unescape.c +48 -85
- data/stdlib/bigdecimal/0/big_decimal.rbs +82 -100
- data/stdlib/bigdecimal-math/0/big_math.rbs +8 -169
- data/stdlib/cgi/0/core.rbs +396 -2
- data/stdlib/cgi/0/manifest.yaml +0 -1
- data/stdlib/coverage/0/coverage.rbs +1 -3
- data/stdlib/date/0/date.rbs +59 -67
- data/stdlib/date/0/date_time.rbs +1 -1
- data/stdlib/delegate/0/delegator.rbs +7 -10
- data/stdlib/erb/0/erb.rbs +347 -737
- data/stdlib/fileutils/0/fileutils.rbs +13 -18
- data/stdlib/forwardable/0/forwardable.rbs +0 -3
- data/stdlib/json/0/json.rbs +48 -68
- data/stdlib/net-http/0/net-http.rbs +0 -3
- data/stdlib/objspace/0/objspace.rbs +4 -9
- data/stdlib/open-uri/0/open-uri.rbs +0 -40
- data/stdlib/openssl/0/openssl.rbs +228 -331
- data/stdlib/optparse/0/optparse.rbs +3 -3
- data/{core → stdlib/pathname/0}/pathname.rbs +355 -255
- data/stdlib/psych/0/psych.rbs +3 -3
- data/stdlib/rdoc/0/rdoc.rbs +1 -1
- data/stdlib/resolv/0/resolv.rbs +68 -25
- data/stdlib/ripper/0/ripper.rbs +2 -5
- data/stdlib/singleton/0/singleton.rbs +0 -3
- data/stdlib/socket/0/socket.rbs +1 -13
- data/stdlib/socket/0/tcp_socket.rbs +2 -10
- data/stdlib/stringio/0/stringio.rbs +85 -1176
- data/stdlib/strscan/0/string_scanner.rbs +31 -31
- data/stdlib/tempfile/0/tempfile.rbs +3 -3
- data/stdlib/time/0/time.rbs +1 -1
- data/stdlib/timeout/0/timeout.rbs +7 -63
- data/stdlib/tsort/0/cyclic.rbs +0 -3
- data/stdlib/uri/0/common.rbs +2 -11
- data/stdlib/uri/0/file.rbs +1 -1
- data/stdlib/uri/0/generic.rbs +16 -17
- data/stdlib/uri/0/rfc2396_parser.rbs +7 -6
- data/stdlib/zlib/0/zstream.rbs +0 -1
- metadata +40 -12
- data/.clang-format +0 -74
- data/.clangd +0 -2
- data/.github/workflows/c-check.yml +0 -54
- data/core/ruby.rbs +0 -53
- data/docs/aliases.md +0 -79
- data/docs/encoding.md +0 -56
- data/ext/rbs_extension/compat.h +0 -10
- 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
|
-
#
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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.
|
|
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.
|
|
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 { ... }
|
|
374
|
-
# - Thread.new(*args, &proc)
|
|
375
|
-
# - Thread.new(*args) { |args| ... }
|
|
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.
|
|
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
|
|
985
|
-
| (_Exception, ?_ToS message, ?Array[Thread::Backtrace::Location] | Array[String] | nil backtrace
|
|
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
|
-
#
|
|
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
|
-
#
|
|
1430
|
-
#
|
|
1431
|
-
#
|
|
1432
|
-
#
|
|
1433
|
-
#
|
|
1434
|
-
#
|
|
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
|
-
#
|
|
1455
|
-
#
|
|
1456
|
-
#
|
|
1457
|
-
#
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
1570
|
-
# - mutex.
|
|
1506
|
+
# rdoc-file=thread_sync.c
|
|
1507
|
+
# - mutex.unlock -> self
|
|
1571
1508
|
# -->
|
|
1572
|
-
#
|
|
1573
|
-
#
|
|
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
|
-
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
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
|
|
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
|
-
#
|
|
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
|
|
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
|
|
112
|
-
#
|
|
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
|
|
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
|
|
data/core/unbound_method.rbs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# <!-- rdoc-file=proc.c -->
|
|
2
|
-
# Ruby supports two forms of objectified methods. Class
|
|
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
|
|
290
|
+
# - meth.source_location -> [String, Integer]
|
|
291
291
|
# -->
|
|
292
|
-
# Returns the
|
|
293
|
-
#
|
|
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
|
|
310
|
-
#
|
|
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
|
|
162
|
+
# If your gem depends on pathname but the gemspec doesn't include pathname,
|
|
163
163
|
# you need to write the following.
|
|
164
|
-
- name:
|
|
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
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
|
|
134
|
+
RBS_TEST_OPT='-r pathname -I sig'
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
Replacing `
|
|
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='-
|
|
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
|