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/range.rbs
CHANGED
|
@@ -86,14 +86,14 @@
|
|
|
86
86
|
# end
|
|
87
87
|
# a # => [2, 4, 6, 8, 10]
|
|
88
88
|
#
|
|
89
|
-
# A range can be both beginless and endless.
|
|
89
|
+
# A range can be both beginless and endless. For literal beginless, endless
|
|
90
90
|
# ranges, at least the beginning or end of the range must be given as an
|
|
91
91
|
# explicit nil value. It is recommended to use an explicit nil beginning and
|
|
92
|
-
# end, since that is what Ruby uses for Range#inspect:
|
|
92
|
+
# implicit nil end, since that is what Ruby uses for Range#inspect:
|
|
93
93
|
#
|
|
94
|
-
# (nil..) # => (nil..
|
|
95
|
-
# (..nil) # => (nil..
|
|
96
|
-
# (nil..nil) # => (nil..
|
|
94
|
+
# (nil..) # => (nil..)
|
|
95
|
+
# (..nil) # => (nil..)
|
|
96
|
+
# (nil..nil) # => (nil..)
|
|
97
97
|
#
|
|
98
98
|
# ## Ranges and Other Classes
|
|
99
99
|
#
|
|
@@ -351,7 +351,7 @@ class Range[out Elem] < Object
|
|
|
351
351
|
# -->
|
|
352
352
|
# Returns an element from `self` selected by a binary search.
|
|
353
353
|
#
|
|
354
|
-
# See [Binary Searching](rdoc-ref:
|
|
354
|
+
# See [Binary Searching](rdoc-ref:bsearch.rdoc).
|
|
355
355
|
#
|
|
356
356
|
def bsearch: () -> ::Enumerator[Elem, Elem?]
|
|
357
357
|
| () { (Elem) -> (true | false) } -> Elem?
|
|
@@ -936,7 +936,8 @@ class Range[out Elem] < Object
|
|
|
936
936
|
#
|
|
937
937
|
# Related: Range#count.
|
|
938
938
|
#
|
|
939
|
-
def size: () ->
|
|
939
|
+
def size: () -> Integer?
|
|
940
|
+
| () -> Float?
|
|
940
941
|
|
|
941
942
|
# <!--
|
|
942
943
|
# rdoc-file=range.c
|
data/core/rational.rbs
CHANGED
|
@@ -53,16 +53,15 @@ class Rational < Numeric
|
|
|
53
53
|
|
|
54
54
|
# <!--
|
|
55
55
|
# rdoc-file=rational.c
|
|
56
|
-
# -
|
|
56
|
+
# - rat * numeric -> numeric
|
|
57
57
|
# -->
|
|
58
|
-
#
|
|
58
|
+
# Performs multiplication.
|
|
59
59
|
#
|
|
60
|
-
# Rational(
|
|
61
|
-
# Rational(
|
|
62
|
-
# Rational(
|
|
63
|
-
# Rational(
|
|
64
|
-
# Rational(
|
|
65
|
-
# Rational(-2, 9) * Rational(-9, 2) #=> (1/1)
|
|
60
|
+
# Rational(2, 3) * Rational(2, 3) #=> (4/9)
|
|
61
|
+
# Rational(900) * Rational(1) #=> (900/1)
|
|
62
|
+
# Rational(-2, 9) * Rational(-9, 2) #=> (1/1)
|
|
63
|
+
# Rational(9, 8) * 4 #=> (9/2)
|
|
64
|
+
# Rational(20, 9) * 9.8 #=> 21.77777777777778
|
|
66
65
|
#
|
|
67
66
|
def *: (Integer) -> Rational
|
|
68
67
|
| (Rational) -> Rational
|
|
@@ -70,9 +69,9 @@ class Rational < Numeric
|
|
|
70
69
|
|
|
71
70
|
# <!--
|
|
72
71
|
# rdoc-file=rational.c
|
|
73
|
-
# -
|
|
72
|
+
# - rat ** numeric -> numeric
|
|
74
73
|
# -->
|
|
75
|
-
#
|
|
74
|
+
# Performs exponentiation.
|
|
76
75
|
#
|
|
77
76
|
# Rational(2) ** Rational(3) #=> (8/1)
|
|
78
77
|
# Rational(10) ** -2 #=> (1/100)
|
|
@@ -86,25 +85,15 @@ class Rational < Numeric
|
|
|
86
85
|
|
|
87
86
|
# <!--
|
|
88
87
|
# rdoc-file=rational.c
|
|
89
|
-
# -
|
|
88
|
+
# - rat + numeric -> numeric
|
|
90
89
|
# -->
|
|
91
|
-
#
|
|
90
|
+
# Performs addition.
|
|
92
91
|
#
|
|
93
|
-
# Rational(2, 3)
|
|
94
|
-
# Rational(
|
|
95
|
-
# Rational(2,
|
|
96
|
-
#
|
|
97
|
-
# Rational(
|
|
98
|
-
#
|
|
99
|
-
# Rational(2, 3) + Rational(1, 1) # => (5/3)
|
|
100
|
-
# Rational(2, 3) + Rational(3, 2) # => (13/6)
|
|
101
|
-
# Rational(2, 3) + Rational(3.0, 2.0) # => (13/6)
|
|
102
|
-
# Rational(2, 3) + Rational(3.1, 2.1) # => (30399297484750849/14186338826217063)
|
|
103
|
-
#
|
|
104
|
-
# For a computation involving Floats, the result may be inexact (see Float#+):
|
|
105
|
-
#
|
|
106
|
-
# Rational(2, 3) + 1.0 # => 1.6666666666666665
|
|
107
|
-
# Rational(2, 3) + Complex(1.0, 0.0) # => (1.6666666666666665+0.0i)
|
|
92
|
+
# Rational(2, 3) + Rational(2, 3) #=> (4/3)
|
|
93
|
+
# Rational(900) + Rational(1) #=> (901/1)
|
|
94
|
+
# Rational(-2, 9) + Rational(-9, 2) #=> (-85/18)
|
|
95
|
+
# Rational(9, 8) + 4 #=> (41/8)
|
|
96
|
+
# Rational(20, 9) + 9.8 #=> 12.022222222222222
|
|
108
97
|
#
|
|
109
98
|
def +: (Float) -> Float
|
|
110
99
|
| (Complex) -> Complex
|
|
@@ -114,9 +103,9 @@ class Rational < Numeric
|
|
|
114
103
|
|
|
115
104
|
# <!--
|
|
116
105
|
# rdoc-file=rational.c
|
|
117
|
-
# -
|
|
106
|
+
# - rat - numeric -> numeric
|
|
118
107
|
# -->
|
|
119
|
-
#
|
|
108
|
+
# Performs subtraction.
|
|
120
109
|
#
|
|
121
110
|
# Rational(2, 3) - Rational(2, 3) #=> (0/1)
|
|
122
111
|
# Rational(900) - Rational(1) #=> (899/1)
|
|
@@ -130,20 +119,18 @@ class Rational < Numeric
|
|
|
130
119
|
|
|
131
120
|
# <!--
|
|
132
121
|
# rdoc-file=rational.c
|
|
133
|
-
# - -
|
|
122
|
+
# - -rat -> rational
|
|
134
123
|
# -->
|
|
135
|
-
#
|
|
136
|
-
#
|
|
137
|
-
# -(1/3r) # => (-1/3)
|
|
138
|
-
# -(-1/3r) # => (1/3)
|
|
124
|
+
# Negates `rat`.
|
|
139
125
|
#
|
|
140
126
|
def -@: () -> Rational
|
|
141
127
|
|
|
142
128
|
# <!--
|
|
143
129
|
# rdoc-file=rational.c
|
|
144
|
-
# -
|
|
130
|
+
# - rat / numeric -> numeric
|
|
131
|
+
# - rat.quo(numeric) -> numeric
|
|
145
132
|
# -->
|
|
146
|
-
#
|
|
133
|
+
# Performs division.
|
|
147
134
|
#
|
|
148
135
|
# Rational(2, 3) / Rational(2, 3) #=> (1/1)
|
|
149
136
|
# Rational(900) / Rational(1) #=> (900/1)
|
|
@@ -377,7 +364,7 @@ class Rational < Numeric
|
|
|
377
364
|
def positive?: () -> bool
|
|
378
365
|
|
|
379
366
|
# <!-- rdoc-file=rational.c -->
|
|
380
|
-
#
|
|
367
|
+
# Performs division.
|
|
381
368
|
#
|
|
382
369
|
# Rational(2, 3) / Rational(2, 3) #=> (1/1)
|
|
383
370
|
# Rational(900) / Rational(1) #=> (900/1)
|
data/core/rbs/unnamed/argf.rbs
CHANGED
|
@@ -93,7 +93,7 @@ module RBS
|
|
|
93
93
|
# * File `t.rb`:
|
|
94
94
|
#
|
|
95
95
|
# p "ARGV: #{ARGV}"
|
|
96
|
-
# p "
|
|
96
|
+
# p "Line: #{ARGF.read}" # Read everything from all specified streams.
|
|
97
97
|
#
|
|
98
98
|
# * Command and output:
|
|
99
99
|
#
|
|
@@ -836,7 +836,7 @@ module RBS
|
|
|
836
836
|
# Formats and writes `objects` to the stream.
|
|
837
837
|
#
|
|
838
838
|
# For details on `format_string`, see [Format
|
|
839
|
-
# Specifications](rdoc-ref:
|
|
839
|
+
# Specifications](rdoc-ref:format_specifications.rdoc).
|
|
840
840
|
#
|
|
841
841
|
%a{annotate:rdoc:copy:ARGF#printf}
|
|
842
842
|
def printf: (String format_string, *untyped args) -> nil
|
|
@@ -140,7 +140,7 @@ module RBS
|
|
|
140
140
|
#
|
|
141
141
|
# * ::assoc: Returns a 2-element array containing the name and value of the
|
|
142
142
|
# named environment variable if it exists:
|
|
143
|
-
# * ::clone:
|
|
143
|
+
# * ::clone: Returns `ENV` (and issues a warning).
|
|
144
144
|
# * ::except: Returns a hash of all name/value pairs except those given.
|
|
145
145
|
# * ::fetch: Returns the value for the given name.
|
|
146
146
|
# * ::inspect: Returns the contents of `ENV` as a string.
|
data/core/rbs/unnamed/random.rbs
CHANGED
|
@@ -31,11 +31,9 @@ module RBS
|
|
|
31
31
|
# prng.rand(100) # => 42
|
|
32
32
|
#
|
|
33
33
|
# When `max` is a Float, `rand` returns a random floating point number between
|
|
34
|
-
# 0.0 and `max`, including 0.0 and excluding `max`.
|
|
35
|
-
# differently from Kernel.rand.
|
|
34
|
+
# 0.0 and `max`, including 0.0 and excluding `max`.
|
|
36
35
|
#
|
|
37
|
-
# prng.rand(1.5)
|
|
38
|
-
# rand(1.5) # => 0
|
|
36
|
+
# prng.rand(1.5) # => 1.4600282860034115
|
|
39
37
|
#
|
|
40
38
|
# When `range` is a Range, `rand` returns a random number where
|
|
41
39
|
# `range.member?(number) == true`.
|
data/core/regexp.rbs
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
# most such methods accept an argument that may be either a string or the
|
|
40
40
|
# (much more powerful) regexp.
|
|
41
41
|
#
|
|
42
|
-
# See [Regexp Methods](rdoc-ref:
|
|
42
|
+
# See [Regexp Methods](rdoc-ref:regexp/methods.rdoc).
|
|
43
43
|
#
|
|
44
44
|
# ## Regexp Objects
|
|
45
45
|
#
|
|
@@ -126,9 +126,6 @@
|
|
|
126
126
|
# `nil`. Note that `$0` is quite different; it returns the name of the
|
|
127
127
|
# currently executing program.
|
|
128
128
|
#
|
|
129
|
-
# These variables, except for `$~`, are shorthands for methods of `$~`. See
|
|
130
|
-
# MatchData@Global+variables+equivalence.
|
|
131
|
-
#
|
|
132
129
|
# Examples:
|
|
133
130
|
#
|
|
134
131
|
# # Matched string, but no matched groups.
|
|
@@ -438,9 +435,6 @@
|
|
|
438
435
|
# /(?<=<b>)\w+(?=<\/b>)/.match("Fortune favors the <b>bold</b>.")
|
|
439
436
|
# # => #<MatchData "bold">
|
|
440
437
|
#
|
|
441
|
-
# The pattern in lookbehind must be fixed-width. But top-level alternatives can
|
|
442
|
-
# be of various lengths. ex. (?<=a|bc) is OK. (?<=aaa(?:b|cd)) is not allowed.
|
|
443
|
-
#
|
|
444
438
|
# #### Match-Reset Anchor
|
|
445
439
|
#
|
|
446
440
|
# * `\K`: Match reset: the matched content preceding `\K` in the regexp is
|
|
@@ -501,7 +495,7 @@
|
|
|
501
495
|
# /\w*/.match('x')
|
|
502
496
|
# # => #<MatchData "x">
|
|
503
497
|
# /\w*/.match('xyz')
|
|
504
|
-
# # => #<MatchData "
|
|
498
|
+
# # => #<MatchData "yz">
|
|
505
499
|
#
|
|
506
500
|
# * `+` - Matches one or more times:
|
|
507
501
|
#
|
|
@@ -714,7 +708,7 @@
|
|
|
714
708
|
#
|
|
715
709
|
# 1. The leading subexpression `"` in the pattern matches the first character
|
|
716
710
|
# `"` in the target string.
|
|
717
|
-
# 2. The next subexpression `.*` matches the next substring `Quote
|
|
711
|
+
# 2. The next subexpression `.*` matches the next substring `Quote“` (including
|
|
718
712
|
# the trailing double-quote).
|
|
719
713
|
# 3. Now there is nothing left in the target string to match the trailing
|
|
720
714
|
# subexpression `"` in the pattern; this would cause the overall match to
|
|
@@ -821,8 +815,8 @@
|
|
|
821
815
|
# /\P{Alpha}/.match('1') # => #<MatchData "1">
|
|
822
816
|
# /\P{Alpha}/.match('a') # => nil
|
|
823
817
|
#
|
|
824
|
-
# See [Unicode Properties](rdoc-ref:
|
|
825
|
-
#
|
|
818
|
+
# See [Unicode Properties](rdoc-ref:regexp/unicode_properties.rdoc) for regexps
|
|
819
|
+
# based on the numerous properties.
|
|
826
820
|
#
|
|
827
821
|
# Some commonly-used properties correspond to POSIX bracket expressions:
|
|
828
822
|
#
|
|
@@ -1254,7 +1248,7 @@
|
|
|
1254
1248
|
#
|
|
1255
1249
|
# Regexp matching can apply an optimization to prevent ReDoS attacks. When the
|
|
1256
1250
|
# optimization is applied, matching time increases linearly (not polynomially or
|
|
1257
|
-
# exponentially) in relation to the input size, and a ReDoS
|
|
1251
|
+
# exponentially) in relation to the input size, and a ReDoS attach is not
|
|
1258
1252
|
# possible.
|
|
1259
1253
|
#
|
|
1260
1254
|
# This optimization is applied if the pattern meets these criteria:
|
|
@@ -1278,14 +1272,21 @@
|
|
|
1278
1272
|
#
|
|
1279
1273
|
# ## References
|
|
1280
1274
|
#
|
|
1281
|
-
# Read:
|
|
1275
|
+
# Read (online PDF books):
|
|
1282
1276
|
#
|
|
1283
|
-
# *
|
|
1284
|
-
#
|
|
1277
|
+
# * [Mastering Regular
|
|
1278
|
+
# Expressions](https://ia902508.us.archive.org/10/items/allitebooks-02/Maste
|
|
1279
|
+
# ring%20Regular%20Expressions%2C%203rd%20Edition.pdf) by Jeffrey E.F.
|
|
1280
|
+
# Friedl.
|
|
1281
|
+
# * [Regular Expressions
|
|
1282
|
+
# Cookbook](https://doc.lagout.org/programmation/Regular%20Expressions/Regul
|
|
1283
|
+
# ar%20Expressions%20Cookbook_%20Detailed%20Solutions%20in%20Eight%20Program
|
|
1284
|
+
# ming%20Languages%20%282nd%20ed.%29%20%5BGoyvaerts%20%26%20Levithan%202012-
|
|
1285
|
+
# 09-06%5D.pdf) by Jan Goyvaerts & Steven Levithan.
|
|
1285
1286
|
#
|
|
1286
|
-
# Explore, test:
|
|
1287
|
+
# Explore, test (interactive online editor):
|
|
1287
1288
|
#
|
|
1288
|
-
# * [Rubular](https://rubular.com/)
|
|
1289
|
+
# * [Rubular](https://rubular.com/).
|
|
1289
1290
|
#
|
|
1290
1291
|
class Regexp
|
|
1291
1292
|
# Represents an object's ability to be converted to a `Regexp`.
|
|
@@ -1296,9 +1297,6 @@ class Regexp
|
|
|
1296
1297
|
def to_regexp: () -> Regexp
|
|
1297
1298
|
end
|
|
1298
1299
|
|
|
1299
|
-
# <!-- rdoc-file=re.c -->
|
|
1300
|
-
# Raised when regexp matching timed out.
|
|
1301
|
-
#
|
|
1302
1300
|
class TimeoutError < RegexpError
|
|
1303
1301
|
end
|
|
1304
1302
|
|
|
@@ -1660,12 +1658,9 @@ class Regexp
|
|
|
1660
1658
|
|
|
1661
1659
|
# <!--
|
|
1662
1660
|
# rdoc-file=re.c
|
|
1663
|
-
# - encoding
|
|
1661
|
+
# - obj.encoding -> encoding
|
|
1664
1662
|
# -->
|
|
1665
|
-
# Returns
|
|
1666
|
-
# [Encodings](rdoc-ref:encodings.rdoc).
|
|
1667
|
-
#
|
|
1668
|
-
# Related: see [Querying](rdoc-ref:String@Querying).
|
|
1663
|
+
# Returns the Encoding object that represents the encoding of obj.
|
|
1669
1664
|
#
|
|
1670
1665
|
def encoding: () -> Encoding
|
|
1671
1666
|
|
data/core/ruby_vm.rbs
CHANGED
|
@@ -443,7 +443,7 @@ module RubyVM::AbstractSyntaxTree
|
|
|
443
443
|
#
|
|
444
444
|
# See ::parse for explanation of keyword argument meaning and usage.
|
|
445
445
|
#
|
|
446
|
-
def self.parse_file: (
|
|
446
|
+
def self.parse_file: (String | ::_ToPath string, ?keep_script_lines: bool, ?error_tolerant: bool, ?keep_tokens: bool) -> Node
|
|
447
447
|
|
|
448
448
|
# <!--
|
|
449
449
|
# rdoc-file=ast.rb
|
|
@@ -683,13 +683,11 @@ module RubyVM::YJIT
|
|
|
683
683
|
|
|
684
684
|
# <!--
|
|
685
685
|
# rdoc-file=yjit.rb
|
|
686
|
-
# - enable(stats: false, log: false
|
|
686
|
+
# - enable(stats: false, log: false)
|
|
687
687
|
# -->
|
|
688
688
|
# Enable YJIT compilation. `stats` option decides whether to enable YJIT stats
|
|
689
|
-
# or not. `
|
|
690
|
-
# whether to enable YJIT compilation logging or not.
|
|
691
|
-
# `call_threshold` can be
|
|
692
|
-
# provided to override default configuration.
|
|
689
|
+
# or not. `compilation_log` decides
|
|
690
|
+
# whether to enable YJIT compilation logging or not.
|
|
693
691
|
# * `stats`:
|
|
694
692
|
# * `false`: Don't enable stats.
|
|
695
693
|
# * `true`: Enable stats. Print stats at exit.
|
data/core/rubygems/errors.rbs
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
# Further RubyGems documentation can be found at:
|
|
18
18
|
#
|
|
19
19
|
# * [RubyGems Guides](https://guides.rubygems.org)
|
|
20
|
-
# * [RubyGems API](https://www.rubydoc.info/github/
|
|
20
|
+
# * [RubyGems API](https://www.rubydoc.info/github/rubygems/rubygems) (also
|
|
21
21
|
# available from `gem server`)
|
|
22
22
|
#
|
|
23
23
|
# ## RubyGems Plugins
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
# ## Bugs
|
|
49
49
|
#
|
|
50
50
|
# You can submit bugs to the [RubyGems bug
|
|
51
|
-
# tracker](https://github.com/
|
|
51
|
+
# tracker](https://github.com/rubygems/rubygems/issues) on GitHub
|
|
52
52
|
#
|
|
53
53
|
# ## Credits
|
|
54
54
|
#
|
|
@@ -83,13 +83,80 @@
|
|
|
83
83
|
#
|
|
84
84
|
# ## License
|
|
85
85
|
#
|
|
86
|
-
# See
|
|
86
|
+
# See
|
|
87
|
+
# [LICENSE.txt](https://github.com/rubygems/rubygems/blob/master/LICENSE.txt)
|
|
87
88
|
# for permissions.
|
|
88
89
|
#
|
|
89
90
|
# Thanks!
|
|
90
91
|
#
|
|
91
92
|
# -The RubyGems Team
|
|
92
93
|
#
|
|
94
|
+
# <!-- rdoc-file=lib/rubygems/deprecate.rb -->
|
|
95
|
+
# Provides 3 methods for declaring when something is going away.
|
|
96
|
+
#
|
|
97
|
+
# +deprecate(name, repl, year, month)+:
|
|
98
|
+
# Indicate something may be removed on/after a certain date.
|
|
99
|
+
#
|
|
100
|
+
# +rubygems_deprecate(name, replacement=:none)+:
|
|
101
|
+
# Indicate something will be removed in the next major RubyGems version,
|
|
102
|
+
# and (optionally) a replacement for it.
|
|
103
|
+
#
|
|
104
|
+
# `rubygems_deprecate_command`:
|
|
105
|
+
# Indicate a RubyGems command (in +lib/rubygems/commands/*.rb+) will be
|
|
106
|
+
# removed in the next RubyGems version.
|
|
107
|
+
#
|
|
108
|
+
# Also provides `skip_during` for temporarily turning off deprecation warnings.
|
|
109
|
+
# This is intended to be used in the test suite, so deprecation warnings don't
|
|
110
|
+
# cause test failures if you need to make sure stderr is otherwise empty.
|
|
111
|
+
#
|
|
112
|
+
# Example usage of `deprecate` and `rubygems_deprecate`:
|
|
113
|
+
#
|
|
114
|
+
# class Legacy
|
|
115
|
+
# def self.some_class_method
|
|
116
|
+
# # ...
|
|
117
|
+
# end
|
|
118
|
+
#
|
|
119
|
+
# def some_instance_method
|
|
120
|
+
# # ...
|
|
121
|
+
# end
|
|
122
|
+
#
|
|
123
|
+
# def some_old_method
|
|
124
|
+
# # ...
|
|
125
|
+
# end
|
|
126
|
+
#
|
|
127
|
+
# extend Gem::Deprecate
|
|
128
|
+
# deprecate :some_instance_method, "X.z", 2011, 4
|
|
129
|
+
# rubygems_deprecate :some_old_method, "Modern#some_new_method"
|
|
130
|
+
#
|
|
131
|
+
# class << self
|
|
132
|
+
# extend Gem::Deprecate
|
|
133
|
+
# deprecate :some_class_method, :none, 2011, 4
|
|
134
|
+
# end
|
|
135
|
+
# end
|
|
136
|
+
#
|
|
137
|
+
# Example usage of `rubygems_deprecate_command`:
|
|
138
|
+
#
|
|
139
|
+
# class Gem::Commands::QueryCommand < Gem::Command
|
|
140
|
+
# extend Gem::Deprecate
|
|
141
|
+
# rubygems_deprecate_command
|
|
142
|
+
#
|
|
143
|
+
# # ...
|
|
144
|
+
# end
|
|
145
|
+
#
|
|
146
|
+
# Example usage of `skip_during`:
|
|
147
|
+
#
|
|
148
|
+
# class TestSomething < Gem::Testcase
|
|
149
|
+
# def test_some_thing_with_deprecations
|
|
150
|
+
# Gem::Deprecate.skip_during do
|
|
151
|
+
# actual_stdout, actual_stderr = capture_output do
|
|
152
|
+
# Gem.something_deprecated
|
|
153
|
+
# end
|
|
154
|
+
# assert_empty actual_stdout
|
|
155
|
+
# assert_equal(expected, actual_stderr)
|
|
156
|
+
# end
|
|
157
|
+
# end
|
|
158
|
+
# end
|
|
159
|
+
#
|
|
93
160
|
module Gem
|
|
94
161
|
# <!-- rdoc-file=lib/rubygems/errors.rb -->
|
|
95
162
|
# Raised when RubyGems is unable to load or activate a gem. Contains the name
|
data/core/rubygems/rubygems.rbs
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
# Further RubyGems documentation can be found at:
|
|
18
18
|
#
|
|
19
19
|
# * [RubyGems Guides](https://guides.rubygems.org)
|
|
20
|
-
# * [RubyGems API](https://www.rubydoc.info/github/
|
|
20
|
+
# * [RubyGems API](https://www.rubydoc.info/github/rubygems/rubygems) (also
|
|
21
21
|
# available from `gem server`)
|
|
22
22
|
#
|
|
23
23
|
# ## RubyGems Plugins
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
# ## Bugs
|
|
49
49
|
#
|
|
50
50
|
# You can submit bugs to the [RubyGems bug
|
|
51
|
-
# tracker](https://github.com/
|
|
51
|
+
# tracker](https://github.com/rubygems/rubygems/issues) on GitHub
|
|
52
52
|
#
|
|
53
53
|
# ## Credits
|
|
54
54
|
#
|
|
@@ -83,13 +83,80 @@
|
|
|
83
83
|
#
|
|
84
84
|
# ## License
|
|
85
85
|
#
|
|
86
|
-
# See
|
|
86
|
+
# See
|
|
87
|
+
# [LICENSE.txt](https://github.com/rubygems/rubygems/blob/master/LICENSE.txt)
|
|
87
88
|
# for permissions.
|
|
88
89
|
#
|
|
89
90
|
# Thanks!
|
|
90
91
|
#
|
|
91
92
|
# -The RubyGems Team
|
|
92
93
|
#
|
|
94
|
+
# <!-- rdoc-file=lib/rubygems/deprecate.rb -->
|
|
95
|
+
# Provides 3 methods for declaring when something is going away.
|
|
96
|
+
#
|
|
97
|
+
# +deprecate(name, repl, year, month)+:
|
|
98
|
+
# Indicate something may be removed on/after a certain date.
|
|
99
|
+
#
|
|
100
|
+
# +rubygems_deprecate(name, replacement=:none)+:
|
|
101
|
+
# Indicate something will be removed in the next major RubyGems version,
|
|
102
|
+
# and (optionally) a replacement for it.
|
|
103
|
+
#
|
|
104
|
+
# `rubygems_deprecate_command`:
|
|
105
|
+
# Indicate a RubyGems command (in +lib/rubygems/commands/*.rb+) will be
|
|
106
|
+
# removed in the next RubyGems version.
|
|
107
|
+
#
|
|
108
|
+
# Also provides `skip_during` for temporarily turning off deprecation warnings.
|
|
109
|
+
# This is intended to be used in the test suite, so deprecation warnings don't
|
|
110
|
+
# cause test failures if you need to make sure stderr is otherwise empty.
|
|
111
|
+
#
|
|
112
|
+
# Example usage of `deprecate` and `rubygems_deprecate`:
|
|
113
|
+
#
|
|
114
|
+
# class Legacy
|
|
115
|
+
# def self.some_class_method
|
|
116
|
+
# # ...
|
|
117
|
+
# end
|
|
118
|
+
#
|
|
119
|
+
# def some_instance_method
|
|
120
|
+
# # ...
|
|
121
|
+
# end
|
|
122
|
+
#
|
|
123
|
+
# def some_old_method
|
|
124
|
+
# # ...
|
|
125
|
+
# end
|
|
126
|
+
#
|
|
127
|
+
# extend Gem::Deprecate
|
|
128
|
+
# deprecate :some_instance_method, "X.z", 2011, 4
|
|
129
|
+
# rubygems_deprecate :some_old_method, "Modern#some_new_method"
|
|
130
|
+
#
|
|
131
|
+
# class << self
|
|
132
|
+
# extend Gem::Deprecate
|
|
133
|
+
# deprecate :some_class_method, :none, 2011, 4
|
|
134
|
+
# end
|
|
135
|
+
# end
|
|
136
|
+
#
|
|
137
|
+
# Example usage of `rubygems_deprecate_command`:
|
|
138
|
+
#
|
|
139
|
+
# class Gem::Commands::QueryCommand < Gem::Command
|
|
140
|
+
# extend Gem::Deprecate
|
|
141
|
+
# rubygems_deprecate_command
|
|
142
|
+
#
|
|
143
|
+
# # ...
|
|
144
|
+
# end
|
|
145
|
+
#
|
|
146
|
+
# Example usage of `skip_during`:
|
|
147
|
+
#
|
|
148
|
+
# class TestSomething < Gem::Testcase
|
|
149
|
+
# def test_some_thing_with_deprecations
|
|
150
|
+
# Gem::Deprecate.skip_during do
|
|
151
|
+
# actual_stdout, actual_stderr = capture_output do
|
|
152
|
+
# Gem.something_deprecated
|
|
153
|
+
# end
|
|
154
|
+
# assert_empty actual_stdout
|
|
155
|
+
# assert_equal(expected, actual_stderr)
|
|
156
|
+
# end
|
|
157
|
+
# end
|
|
158
|
+
# end
|
|
159
|
+
#
|
|
93
160
|
module Gem
|
|
94
161
|
interface _HashLike[K, V]
|
|
95
162
|
def each_pair: () { ([ K, V ]) -> untyped } -> self
|
|
@@ -137,7 +204,7 @@ module Gem
|
|
|
137
204
|
|
|
138
205
|
VERSION: String
|
|
139
206
|
|
|
140
|
-
# <!-- rdoc-file=lib/rubygems
|
|
207
|
+
# <!-- rdoc-file=lib/rubygems.rb -->
|
|
141
208
|
# An Array of Regexps that match windows Ruby platforms.
|
|
142
209
|
#
|
|
143
210
|
WIN_PATTERNS: Array[Regexp]
|
|
@@ -184,7 +251,7 @@ module Gem
|
|
|
184
251
|
|
|
185
252
|
# <!--
|
|
186
253
|
# rdoc-file=lib/rubygems.rb
|
|
187
|
-
# - bindir(install_dir
|
|
254
|
+
# - bindir(install_dir=Gem.dir)
|
|
188
255
|
# -->
|
|
189
256
|
# The path where gem executables are to be installed.
|
|
190
257
|
#
|
|
@@ -442,7 +509,7 @@ module Gem
|
|
|
442
509
|
|
|
443
510
|
# <!--
|
|
444
511
|
# rdoc-file=lib/rubygems.rb
|
|
445
|
-
# - find_files(glob, check_load_path
|
|
512
|
+
# - find_files(glob, check_load_path=true)
|
|
446
513
|
# -->
|
|
447
514
|
# Returns a list of paths matching `glob` that can be used by a gem to pick up
|
|
448
515
|
# features from other gems. For example:
|
|
@@ -459,7 +526,7 @@ module Gem
|
|
|
459
526
|
|
|
460
527
|
# <!--
|
|
461
528
|
# rdoc-file=lib/rubygems.rb
|
|
462
|
-
# - find_latest_files(glob, check_load_path
|
|
529
|
+
# - find_latest_files(glob, check_load_path=true)
|
|
463
530
|
# -->
|
|
464
531
|
# Returns a list of paths matching `glob` from the latest gems that can be used
|
|
465
532
|
# by a gem to pick up features from other gems. For example:
|
|
@@ -484,7 +551,7 @@ module Gem
|
|
|
484
551
|
|
|
485
552
|
# <!--
|
|
486
553
|
# rdoc-file=lib/rubygems.rb
|
|
487
|
-
# - finish_resolve(request_set
|
|
554
|
+
# - finish_resolve(request_set=Gem::RequestSet.new)
|
|
488
555
|
# -->
|
|
489
556
|
#
|
|
490
557
|
def self.finish_resolve: (?RequestSet request_set) -> void
|
|
@@ -737,7 +804,7 @@ module Gem
|
|
|
737
804
|
|
|
738
805
|
# <!--
|
|
739
806
|
# rdoc-file=lib/rubygems.rb
|
|
740
|
-
# - plugindir(install_dir
|
|
807
|
+
# - plugindir(install_dir=Gem.dir)
|
|
741
808
|
# -->
|
|
742
809
|
# The path were rubygems plugins are to be installed.
|
|
743
810
|
#
|
|
@@ -942,7 +1009,8 @@ module Gem
|
|
|
942
1009
|
# - source_date_epoch_string()
|
|
943
1010
|
# -->
|
|
944
1011
|
# If the SOURCE_DATE_EPOCH environment variable is set, returns it's value.
|
|
945
|
-
# Otherwise, returns
|
|
1012
|
+
# Otherwise, returns the time that `Gem.source_date_epoch_string` was first
|
|
1013
|
+
# called in the same format as SOURCE_DATE_EPOCH.
|
|
946
1014
|
#
|
|
947
1015
|
# NOTE(@duckinator): The implementation is a tad weird because we want to:
|
|
948
1016
|
# 1. Make builds reproducible by default, by having this function always
|
|
@@ -1086,7 +1154,7 @@ module Gem
|
|
|
1086
1154
|
def self.user_home: () -> String
|
|
1087
1155
|
|
|
1088
1156
|
# <!--
|
|
1089
|
-
# rdoc-file=lib/rubygems
|
|
1157
|
+
# rdoc-file=lib/rubygems.rb
|
|
1090
1158
|
# - win_platform?()
|
|
1091
1159
|
# -->
|
|
1092
1160
|
# Is this a windows platform?
|
data/core/rubygems/version.rbs
CHANGED
|
@@ -180,6 +180,7 @@ module Gem
|
|
|
180
180
|
#
|
|
181
181
|
# ver1 = Version.create('1.3.17') # -> (Version object)
|
|
182
182
|
# ver2 = Version.create(ver1) # -> (ver1)
|
|
183
|
+
# ver3 = Version.create(nil) # -> nil
|
|
183
184
|
#
|
|
184
185
|
def self.create: (_ToS | Version input) -> instance
|
|
185
186
|
| (nil input) -> nil
|
|
@@ -198,8 +199,8 @@ module Gem
|
|
|
198
199
|
# - <=>(other)
|
|
199
200
|
# -->
|
|
200
201
|
# Compares this version with `other` returning -1, 0, or 1 if the other version
|
|
201
|
-
# is larger, the same, or smaller than this one.
|
|
202
|
-
# Gem::Version
|
|
202
|
+
# is larger, the same, or smaller than this one. Attempts to compare to
|
|
203
|
+
# something that's not a `Gem::Version` or a valid version String return `nil`.
|
|
203
204
|
#
|
|
204
205
|
def <=>: (untyped other) -> Integer?
|
|
205
206
|
|