rbs 3.9.4 → 3.10.2
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/.clang-format +74 -0
- data/.clangd +2 -0
- data/.github/workflows/c-check.yml +54 -0
- data/.github/workflows/comments.yml +2 -2
- data/.github/workflows/ruby.yml +33 -19
- data/.github/workflows/typecheck.yml +1 -1
- data/.github/workflows/windows.yml +1 -1
- data/.gitignore +4 -0
- data/CHANGELOG.md +81 -0
- data/README.md +38 -1
- data/Rakefile +152 -23
- data/config.yml +190 -62
- data/core/array.rbs +96 -46
- data/core/comparable.rbs +13 -6
- data/core/complex.rbs +40 -25
- data/core/dir.rbs +4 -4
- data/core/encoding.rbs +6 -9
- data/core/enumerable.rbs +90 -3
- data/core/enumerator.rbs +43 -1
- data/core/errno.rbs +8 -0
- data/core/errors.rbs +28 -1
- data/core/exception.rbs +2 -2
- data/core/fiber.rbs +29 -20
- data/core/file.rbs +49 -19
- data/core/file_test.rbs +1 -1
- data/core/float.rbs +224 -33
- data/core/gc.rbs +417 -281
- data/core/hash.rbs +1023 -727
- data/core/integer.rbs +104 -63
- data/core/io/buffer.rbs +21 -10
- data/core/io/wait.rbs +11 -33
- data/core/io.rbs +14 -12
- data/core/kernel.rbs +61 -51
- data/core/marshal.rbs +1 -1
- data/core/match_data.rbs +1 -1
- data/core/math.rbs +42 -3
- data/core/method.rbs +63 -25
- data/core/module.rbs +101 -23
- data/core/nil_class.rbs +3 -3
- data/core/numeric.rbs +25 -17
- data/core/object.rbs +3 -3
- data/core/object_space.rbs +21 -15
- data/core/pathname.rbs +1272 -0
- data/core/proc.rbs +30 -24
- data/core/process.rbs +2 -2
- data/core/ractor.rbs +361 -509
- data/core/range.rbs +7 -8
- data/core/rational.rbs +56 -34
- data/core/rbs/unnamed/argf.rbs +2 -2
- data/core/rbs/unnamed/env_class.rbs +1 -1
- data/core/rbs/unnamed/random.rbs +4 -2
- data/core/regexp.rbs +25 -20
- data/core/ruby.rbs +53 -0
- data/core/ruby_vm.rbs +6 -4
- data/core/rubygems/errors.rbs +3 -70
- data/core/rubygems/rubygems.rbs +11 -79
- data/core/rubygems/version.rbs +2 -3
- data/core/set.rbs +488 -359
- data/core/signal.rbs +24 -14
- data/core/string.rbs +3164 -1235
- data/core/struct.rbs +1 -1
- data/core/symbol.rbs +17 -11
- data/core/thread.rbs +95 -33
- data/core/time.rbs +35 -9
- data/core/trace_point.rbs +7 -4
- data/core/unbound_method.rbs +14 -6
- data/docs/aliases.md +79 -0
- data/docs/collection.md +2 -2
- data/docs/encoding.md +56 -0
- data/docs/gem.md +0 -1
- data/docs/sigs.md +3 -3
- data/ext/rbs_extension/ast_translation.c +1016 -0
- data/ext/rbs_extension/ast_translation.h +37 -0
- data/ext/rbs_extension/class_constants.c +155 -0
- data/{include/rbs/constants.h → ext/rbs_extension/class_constants.h} +7 -1
- data/ext/rbs_extension/compat.h +10 -0
- data/ext/rbs_extension/extconf.rb +25 -1
- data/ext/rbs_extension/legacy_location.c +317 -0
- data/ext/rbs_extension/legacy_location.h +45 -0
- data/ext/rbs_extension/main.c +367 -23
- data/ext/rbs_extension/rbs_extension.h +6 -21
- data/ext/rbs_extension/rbs_string_bridging.c +9 -0
- data/ext/rbs_extension/rbs_string_bridging.h +24 -0
- data/include/rbs/ast.h +687 -0
- data/include/rbs/defines.h +86 -0
- data/include/rbs/lexer.h +199 -0
- data/include/rbs/location.h +59 -0
- data/include/rbs/parser.h +135 -0
- data/include/rbs/string.h +47 -0
- data/include/rbs/util/rbs_allocator.h +59 -0
- data/include/rbs/util/rbs_assert.h +20 -0
- data/include/rbs/util/rbs_buffer.h +83 -0
- data/include/rbs/util/rbs_constant_pool.h +6 -67
- data/include/rbs/util/rbs_encoding.h +282 -0
- data/include/rbs/util/rbs_unescape.h +24 -0
- data/include/rbs.h +1 -2
- data/lib/rbs/annotate/formatter.rb +3 -13
- data/lib/rbs/annotate/rdoc_annotator.rb +3 -1
- data/lib/rbs/annotate/rdoc_source.rb +1 -1
- data/lib/rbs/cli/validate.rb +2 -2
- data/lib/rbs/cli.rb +1 -1
- data/lib/rbs/collection/config/lockfile_generator.rb +8 -0
- data/lib/rbs/collection.rb +1 -0
- data/lib/rbs/definition_builder/ancestor_builder.rb +5 -5
- data/lib/rbs/environment.rb +64 -59
- data/lib/rbs/environment_loader.rb +0 -6
- data/lib/rbs/errors.rb +1 -1
- data/lib/rbs/parser_aux.rb +5 -0
- data/lib/rbs/resolver/constant_resolver.rb +2 -2
- data/lib/rbs/resolver/type_name_resolver.rb +124 -38
- data/lib/rbs/subtractor.rb +3 -1
- data/lib/rbs/test/type_check.rb +14 -0
- data/lib/rbs/types.rb +3 -1
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +1 -1
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +3 -3
- data/sig/annotate/formatter.rbs +2 -2
- data/sig/annotate/rdoc_annotater.rbs +1 -1
- data/sig/environment.rbs +57 -6
- data/sig/manifest.yaml +0 -1
- data/sig/parser.rbs +20 -0
- data/sig/resolver/type_name_resolver.rbs +38 -7
- data/sig/types.rbs +4 -1
- data/src/ast.c +1256 -0
- data/src/lexer.c +2956 -0
- data/src/lexer.re +147 -0
- data/src/lexstate.c +205 -0
- data/src/location.c +71 -0
- data/src/parser.c +3507 -0
- data/src/string.c +41 -0
- data/src/util/rbs_allocator.c +165 -0
- data/src/util/rbs_assert.c +19 -0
- data/src/util/rbs_buffer.c +54 -0
- data/src/util/rbs_constant_pool.c +18 -88
- data/src/util/rbs_encoding.c +21308 -0
- data/src/util/rbs_unescape.c +167 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +100 -82
- data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
- data/stdlib/cgi/0/core.rbs +9 -393
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/cgi-escape/0/escape.rbs +171 -0
- data/stdlib/coverage/0/coverage.rbs +3 -1
- data/stdlib/date/0/date.rbs +67 -59
- data/stdlib/date/0/date_time.rbs +1 -1
- data/stdlib/delegate/0/delegator.rbs +10 -7
- data/stdlib/erb/0/erb.rbs +737 -347
- data/stdlib/fileutils/0/fileutils.rbs +18 -13
- data/stdlib/forwardable/0/forwardable.rbs +3 -0
- data/stdlib/json/0/json.rbs +68 -48
- data/stdlib/net-http/0/net-http.rbs +3 -0
- data/stdlib/objspace/0/objspace.rbs +9 -4
- data/stdlib/open-uri/0/open-uri.rbs +40 -0
- data/stdlib/openssl/0/openssl.rbs +331 -228
- data/stdlib/optparse/0/optparse.rbs +3 -3
- data/stdlib/pathname/0/pathname.rbs +9 -1379
- data/stdlib/psych/0/psych.rbs +3 -3
- data/stdlib/rdoc/0/code_object.rbs +2 -2
- data/stdlib/rdoc/0/comment.rbs +2 -0
- data/stdlib/rdoc/0/options.rbs +76 -0
- data/stdlib/rdoc/0/rdoc.rbs +7 -5
- data/stdlib/rdoc/0/store.rbs +1 -1
- data/stdlib/resolv/0/resolv.rbs +25 -68
- data/stdlib/ripper/0/ripper.rbs +5 -2
- data/stdlib/singleton/0/singleton.rbs +3 -0
- data/stdlib/socket/0/socket.rbs +13 -1
- data/stdlib/socket/0/tcp_socket.rbs +10 -2
- data/stdlib/stringio/0/stringio.rbs +1176 -85
- 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 +63 -7
- data/stdlib/tsort/0/cyclic.rbs +3 -0
- data/stdlib/uri/0/common.rbs +11 -2
- data/stdlib/uri/0/file.rbs +1 -1
- data/stdlib/uri/0/generic.rbs +17 -16
- data/stdlib/uri/0/rfc2396_parser.rbs +6 -7
- data/stdlib/zlib/0/zstream.rbs +1 -0
- metadata +44 -18
- data/ext/rbs_extension/lexer.c +0 -2728
- data/ext/rbs_extension/lexer.h +0 -179
- data/ext/rbs_extension/lexer.re +0 -147
- data/ext/rbs_extension/lexstate.c +0 -175
- data/ext/rbs_extension/location.c +0 -325
- data/ext/rbs_extension/location.h +0 -85
- data/ext/rbs_extension/parser.c +0 -2982
- data/ext/rbs_extension/parser.h +0 -18
- data/ext/rbs_extension/parserstate.c +0 -411
- data/ext/rbs_extension/parserstate.h +0 -163
- data/ext/rbs_extension/unescape.c +0 -32
- data/include/rbs/ruby_objs.h +0 -72
- data/src/constants.c +0 -153
- data/src/ruby_objs.c +0 -799
data/core/proc.rbs
CHANGED
|
@@ -201,8 +201,8 @@
|
|
|
201
201
|
# ["Bob", "Jane"].map(&hi) #=> ["Hi, Bob!", "Hi, Jane!"]
|
|
202
202
|
# ["Bob", "Jane"].map(&hey) #=> ["Hey, Bob!", "Hey, Jane!"]
|
|
203
203
|
#
|
|
204
|
-
# Of the Ruby core classes, this method is implemented by Symbol
|
|
205
|
-
# Hash
|
|
204
|
+
# Of the Ruby core classes, this method is implemented by `Symbol`, `Method`,
|
|
205
|
+
# and `Hash`.
|
|
206
206
|
#
|
|
207
207
|
# :to_s.to_proc.call(1) #=> "1"
|
|
208
208
|
# [1, 2].map(&:to_s) #=> ["1", "2"]
|
|
@@ -285,7 +285,7 @@
|
|
|
285
285
|
# [1, 2, 3].each { |x| p it }
|
|
286
286
|
# # syntax error found (SyntaxError)
|
|
287
287
|
# # [1, 2, 3].each { |x| p it }
|
|
288
|
-
# # ^~
|
|
288
|
+
# # ^~ 'it' is not allowed when an ordinary parameter is defined
|
|
289
289
|
#
|
|
290
290
|
# But if a local name (variable or method) is available, it would be used:
|
|
291
291
|
#
|
|
@@ -302,7 +302,7 @@
|
|
|
302
302
|
#
|
|
303
303
|
# p = proc { it**2 }
|
|
304
304
|
# l = lambda { it**2 }
|
|
305
|
-
# p.parameters # => [[:opt
|
|
305
|
+
# p.parameters # => [[:opt]]
|
|
306
306
|
# p.arity # => 1
|
|
307
307
|
# l.parameters # => [[:req]]
|
|
308
308
|
# l.arity # => 1
|
|
@@ -332,7 +332,7 @@
|
|
|
332
332
|
# Numbered parameters can't be mixed with `it` either:
|
|
333
333
|
#
|
|
334
334
|
# [10, 20, 30].map { _1 + it }
|
|
335
|
-
# # SyntaxError:
|
|
335
|
+
# # SyntaxError: 'it' is not allowed when a numbered parameter is already used
|
|
336
336
|
#
|
|
337
337
|
# To avoid conflicts, naming local variables or method arguments `_1`, `_2` and
|
|
338
338
|
# so on, causes an error.
|
|
@@ -380,9 +380,9 @@ class Proc
|
|
|
380
380
|
def dup: () -> self
|
|
381
381
|
|
|
382
382
|
# <!-- rdoc-file=proc.c -->
|
|
383
|
-
# Invokes the block, setting the block's parameters to the
|
|
384
|
-
#
|
|
385
|
-
#
|
|
383
|
+
# Invokes the block, setting the block's parameters to the arguments using
|
|
384
|
+
# something close to method calling semantics. Returns the value of the last
|
|
385
|
+
# expression evaluated in the block.
|
|
386
386
|
#
|
|
387
387
|
# a_proc = Proc.new {|scalar, *values| values.map {|value| value*scalar } }
|
|
388
388
|
# a_proc.call(9, 1, 2, 3) #=> [9, 18, 27]
|
|
@@ -409,9 +409,9 @@ class Proc
|
|
|
409
409
|
alias === call
|
|
410
410
|
|
|
411
411
|
# <!-- rdoc-file=proc.c -->
|
|
412
|
-
# Invokes the block, setting the block's parameters to the
|
|
413
|
-
#
|
|
414
|
-
#
|
|
412
|
+
# Invokes the block, setting the block's parameters to the arguments using
|
|
413
|
+
# something close to method calling semantics. Returns the value of the last
|
|
414
|
+
# expression evaluated in the block.
|
|
415
415
|
#
|
|
416
416
|
# a_proc = Proc.new {|scalar, *values| values.map {|value| value*scalar } }
|
|
417
417
|
# a_proc.call(9, 1, 2, 3) #=> [9, 18, 27]
|
|
@@ -592,14 +592,13 @@ class Proc
|
|
|
592
592
|
|
|
593
593
|
# <!--
|
|
594
594
|
# rdoc-file=proc.c
|
|
595
|
-
# -
|
|
596
|
-
# -
|
|
597
|
-
# -
|
|
598
|
-
# - prc.yield(params,...) -> obj
|
|
595
|
+
# - call(...) -> obj
|
|
596
|
+
# - self[...] -> obj
|
|
597
|
+
# - yield(...) -> obj
|
|
599
598
|
# -->
|
|
600
|
-
# Invokes the block, setting the block's parameters to the
|
|
601
|
-
#
|
|
602
|
-
#
|
|
599
|
+
# Invokes the block, setting the block's parameters to the arguments using
|
|
600
|
+
# something close to method calling semantics. Returns the value of the last
|
|
601
|
+
# expression evaluated in the block.
|
|
603
602
|
#
|
|
604
603
|
# a_proc = Proc.new {|scalar, *values| values.map {|value| value*scalar } }
|
|
605
604
|
# a_proc.call(9, 1, 2, 3) #=> [9, 18, 27]
|
|
@@ -626,9 +625,9 @@ class Proc
|
|
|
626
625
|
def call: (?) -> untyped
|
|
627
626
|
|
|
628
627
|
# <!-- rdoc-file=proc.c -->
|
|
629
|
-
# Invokes the block, setting the block's parameters to the
|
|
630
|
-
#
|
|
631
|
-
#
|
|
628
|
+
# Invokes the block, setting the block's parameters to the arguments using
|
|
629
|
+
# something close to method calling semantics. Returns the value of the last
|
|
630
|
+
# expression evaluated in the block.
|
|
632
631
|
#
|
|
633
632
|
# a_proc = Proc.new {|scalar, *values| values.map {|value| value*scalar } }
|
|
634
633
|
# a_proc.call(9, 1, 2, 3) #=> [9, 18, 27]
|
|
@@ -835,10 +834,17 @@ class Proc
|
|
|
835
834
|
|
|
836
835
|
# <!--
|
|
837
836
|
# rdoc-file=proc.c
|
|
838
|
-
# - prc.source_location -> [String, Integer]
|
|
837
|
+
# - prc.source_location -> [String, Integer, Integer, Integer, Integer]
|
|
839
838
|
# -->
|
|
840
|
-
# Returns the
|
|
841
|
-
#
|
|
839
|
+
# Returns the location where the Proc was defined. The returned Array contains:
|
|
840
|
+
# (1) the Ruby source filename
|
|
841
|
+
# (2) the line number where the definition starts
|
|
842
|
+
# (3) the column number where the definition starts
|
|
843
|
+
# (4) the line number where the definition ends
|
|
844
|
+
# (5) the column number where the definitions ends
|
|
845
|
+
#
|
|
846
|
+
# This method will return `nil` if the Proc was not defined in Ruby (i.e.
|
|
847
|
+
# native).
|
|
842
848
|
#
|
|
843
849
|
def source_location: () -> [String, Integer]?
|
|
844
850
|
|
data/core/process.rbs
CHANGED
|
@@ -590,7 +590,7 @@ module Process
|
|
|
590
590
|
# * `:microsecond`: Number of microseconds as an integer.
|
|
591
591
|
# * `:millisecond`: Number of milliseconds as an integer.
|
|
592
592
|
# * `:nanosecond`: Number of nanoseconds as an integer.
|
|
593
|
-
# *
|
|
593
|
+
# * `:second`: Number of seconds as an integer.
|
|
594
594
|
#
|
|
595
595
|
# Examples:
|
|
596
596
|
#
|
|
@@ -2023,7 +2023,7 @@ end
|
|
|
2023
2023
|
# <!-- rdoc-file=process.c -->
|
|
2024
2024
|
# The Process::Sys module contains UID and GID functions which provide direct
|
|
2025
2025
|
# bindings to the system calls of the same names instead of the more-portable
|
|
2026
|
-
# versions of the same functionality found in the Process
|
|
2026
|
+
# versions of the same functionality found in the `Process`, Process::UID, and
|
|
2027
2027
|
# Process::GID modules.
|
|
2028
2028
|
#
|
|
2029
2029
|
module Process::Sys
|