rbs 3.10.4 → 4.0.0

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 (267) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +14 -14
  3. data/.github/workflows/bundle-update.yml +60 -0
  4. data/.github/workflows/c-check.yml +7 -5
  5. data/.github/workflows/comments.yml +2 -2
  6. data/.github/workflows/dependabot.yml +2 -2
  7. data/.github/workflows/ruby.yml +16 -26
  8. data/.github/workflows/rust.yml +95 -0
  9. data/.github/workflows/typecheck.yml +1 -1
  10. data/.github/workflows/windows.yml +2 -2
  11. data/.rubocop.yml +2 -2
  12. data/.vscode/extensions.json +5 -0
  13. data/.vscode/settings.json +19 -0
  14. data/CHANGELOG.md +202 -2
  15. data/Rakefile +9 -23
  16. data/Steepfile +2 -0
  17. data/config.yml +457 -13
  18. data/core/array.rbs +218 -188
  19. data/core/basic_object.rbs +9 -8
  20. data/core/binding.rbs +0 -2
  21. data/core/builtin.rbs +2 -2
  22. data/core/class.rbs +6 -5
  23. data/core/comparable.rbs +45 -31
  24. data/core/complex.rbs +66 -55
  25. data/core/dir.rbs +57 -45
  26. data/core/encoding.rbs +6 -6
  27. data/core/enumerable.rbs +105 -91
  28. data/core/enumerator/arithmetic_sequence.rbs +70 -0
  29. data/core/enumerator.rbs +24 -3
  30. data/core/errno.rbs +3 -2
  31. data/core/errors.rbs +31 -29
  32. data/core/exception.rbs +12 -12
  33. data/core/fiber.rbs +47 -36
  34. data/core/file.rbs +242 -169
  35. data/core/file_test.rbs +2 -2
  36. data/core/float.rbs +42 -68
  37. data/core/gc.rbs +78 -70
  38. data/core/hash.rbs +70 -60
  39. data/core/integer.rbs +32 -75
  40. data/core/io/buffer.rbs +36 -36
  41. data/core/io/wait.rbs +7 -7
  42. data/core/io.rbs +192 -146
  43. data/core/kernel.rbs +198 -147
  44. data/core/marshal.rbs +3 -3
  45. data/core/match_data.rbs +14 -12
  46. data/core/math.rbs +69 -67
  47. data/core/method.rbs +6 -8
  48. data/core/module.rbs +148 -88
  49. data/core/nil_class.rbs +4 -3
  50. data/core/numeric.rbs +53 -50
  51. data/core/object.rbs +6 -8
  52. data/core/object_space.rbs +11 -10
  53. data/core/pathname.rbs +131 -81
  54. data/core/proc.rbs +65 -34
  55. data/core/process.rbs +221 -201
  56. data/core/ractor.rbs +15 -11
  57. data/core/random.rbs +21 -3
  58. data/core/range.rbs +152 -49
  59. data/core/rational.rbs +5 -56
  60. data/core/rbs/unnamed/argf.rbs +58 -51
  61. data/core/rbs/unnamed/env_class.rbs +18 -13
  62. data/core/rbs/unnamed/main_class.rbs +123 -0
  63. data/core/rbs/unnamed/random.rbs +7 -116
  64. data/core/regexp.rbs +236 -197
  65. data/core/ruby.rbs +1 -1
  66. data/core/ruby_vm.rbs +32 -30
  67. data/core/rubygems/config_file.rbs +5 -5
  68. data/core/rubygems/errors.rbs +1 -1
  69. data/core/rubygems/requirement.rbs +5 -5
  70. data/core/rubygems/rubygems.rbs +5 -3
  71. data/core/set.rbs +17 -16
  72. data/core/signal.rbs +2 -2
  73. data/core/string.rbs +318 -298
  74. data/core/struct.rbs +26 -25
  75. data/core/symbol.rbs +25 -24
  76. data/core/thread.rbs +40 -41
  77. data/core/time.rbs +47 -42
  78. data/core/trace_point.rbs +34 -31
  79. data/core/true_class.rbs +2 -2
  80. data/core/unbound_method.rbs +10 -10
  81. data/core/warning.rbs +7 -7
  82. data/docs/collection.md +1 -1
  83. data/docs/config.md +171 -0
  84. data/docs/inline.md +576 -0
  85. data/docs/syntax.md +46 -16
  86. data/docs/type_fingerprint.md +21 -0
  87. data/exe/rbs +1 -1
  88. data/ext/rbs_extension/ast_translation.c +595 -98
  89. data/ext/rbs_extension/class_constants.c +30 -0
  90. data/ext/rbs_extension/class_constants.h +15 -0
  91. data/ext/rbs_extension/legacy_location.c +30 -53
  92. data/ext/rbs_extension/legacy_location.h +37 -0
  93. data/ext/rbs_extension/main.c +125 -24
  94. data/include/rbs/ast.h +485 -150
  95. data/include/rbs/lexer.h +11 -4
  96. data/include/rbs/location.h +25 -44
  97. data/include/rbs/parser.h +20 -2
  98. data/include/rbs/util/rbs_constant_pool.h +0 -3
  99. data/include/rbs.h +8 -0
  100. data/lib/rbs/ast/annotation.rb +1 -1
  101. data/lib/rbs/ast/comment.rb +1 -1
  102. data/lib/rbs/ast/declarations.rb +10 -10
  103. data/lib/rbs/ast/members.rb +14 -14
  104. data/lib/rbs/ast/ruby/annotations.rb +409 -0
  105. data/lib/rbs/ast/ruby/comment_block.rb +245 -0
  106. data/lib/rbs/ast/ruby/declarations.rb +281 -0
  107. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +28 -0
  108. data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
  109. data/lib/rbs/ast/ruby/members.rb +723 -0
  110. data/lib/rbs/ast/type_param.rb +24 -4
  111. data/lib/rbs/buffer.rb +105 -20
  112. data/lib/rbs/cli/diff.rb +16 -15
  113. data/lib/rbs/cli/validate.rb +62 -125
  114. data/lib/rbs/cli.rb +55 -23
  115. data/lib/rbs/collection/config/lockfile_generator.rb +8 -4
  116. data/lib/rbs/collection/sources/git.rb +1 -0
  117. data/lib/rbs/collection.rb +0 -1
  118. data/lib/rbs/definition.rb +6 -1
  119. data/lib/rbs/definition_builder/ancestor_builder.rb +119 -63
  120. data/lib/rbs/definition_builder/method_builder.rb +65 -30
  121. data/lib/rbs/definition_builder.rb +177 -20
  122. data/lib/rbs/diff.rb +7 -1
  123. data/lib/rbs/environment/class_entry.rb +69 -0
  124. data/lib/rbs/environment/module_entry.rb +66 -0
  125. data/lib/rbs/environment.rb +338 -155
  126. data/lib/rbs/environment_loader.rb +2 -2
  127. data/lib/rbs/errors.rb +30 -20
  128. data/lib/rbs/inline_parser/comment_association.rb +117 -0
  129. data/lib/rbs/inline_parser.rb +542 -0
  130. data/lib/rbs/location_aux.rb +36 -4
  131. data/lib/rbs/locator.rb +5 -1
  132. data/lib/rbs/method_type.rb +5 -3
  133. data/lib/rbs/namespace.rb +0 -7
  134. data/lib/rbs/parser_aux.rb +31 -8
  135. data/lib/rbs/prototype/helpers.rb +57 -0
  136. data/lib/rbs/prototype/rb.rb +3 -28
  137. data/lib/rbs/prototype/rbi.rb +3 -20
  138. data/lib/rbs/prototype/runtime.rb +10 -2
  139. data/lib/rbs/resolver/type_name_resolver.rb +0 -8
  140. data/lib/rbs/source.rb +99 -0
  141. data/lib/rbs/subtractor.rb +4 -3
  142. data/lib/rbs/test/type_check.rb +5 -2
  143. data/lib/rbs/type_name.rb +1 -8
  144. data/lib/rbs/types.rb +88 -78
  145. data/lib/rbs/unit_test/convertibles.rb +1 -0
  146. data/lib/rbs/unit_test/type_assertions.rb +35 -8
  147. data/lib/rbs/validator.rb +2 -2
  148. data/lib/rbs/version.rb +1 -1
  149. data/lib/rbs.rb +12 -1
  150. data/rbs.gemspec +3 -2
  151. data/rust/.gitignore +1 -0
  152. data/rust/Cargo.lock +378 -0
  153. data/rust/Cargo.toml +7 -0
  154. data/rust/ruby-rbs/Cargo.toml +22 -0
  155. data/rust/ruby-rbs/build.rs +764 -0
  156. data/rust/ruby-rbs/examples/locations.rs +60 -0
  157. data/rust/ruby-rbs/src/lib.rs +1 -0
  158. data/rust/ruby-rbs/src/node/mod.rs +742 -0
  159. data/rust/ruby-rbs/tests/sanity.rs +47 -0
  160. data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
  161. data/rust/ruby-rbs-sys/Cargo.toml +23 -0
  162. data/rust/ruby-rbs-sys/build.rs +204 -0
  163. data/rust/ruby-rbs-sys/src/lib.rs +50 -0
  164. data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
  165. data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
  166. data/rust/ruby-rbs-sys/wrapper.h +1 -0
  167. data/schema/typeParam.json +17 -1
  168. data/sig/ancestor_builder.rbs +1 -1
  169. data/sig/ast/ruby/annotations.rbs +421 -0
  170. data/sig/ast/ruby/comment_block.rbs +127 -0
  171. data/sig/ast/ruby/declarations.rbs +158 -0
  172. data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
  173. data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
  174. data/sig/ast/ruby/members.rbs +178 -0
  175. data/sig/buffer.rbs +63 -5
  176. data/sig/cli/diff.rbs +5 -11
  177. data/sig/cli/validate.rbs +12 -8
  178. data/sig/cli.rbs +18 -18
  179. data/sig/definition.rbs +6 -0
  180. data/sig/definition_builder.rbs +3 -1
  181. data/sig/environment/class_entry.rbs +50 -0
  182. data/sig/environment/module_entry.rbs +50 -0
  183. data/sig/environment.rbs +37 -81
  184. data/sig/errors.rbs +26 -20
  185. data/sig/inline_parser/comment_association.rbs +71 -0
  186. data/sig/inline_parser.rbs +124 -0
  187. data/sig/location.rbs +32 -7
  188. data/sig/locator.rbs +0 -2
  189. data/sig/method_builder.rbs +9 -4
  190. data/sig/namespace.rbs +0 -5
  191. data/sig/parser.rbs +47 -13
  192. data/sig/prototype/helpers.rbs +2 -0
  193. data/sig/resolver/type_name_resolver.rbs +0 -3
  194. data/sig/source.rbs +48 -0
  195. data/sig/type_param.rbs +13 -8
  196. data/sig/typename.rbs +0 -5
  197. data/sig/types.rbs +6 -7
  198. data/sig/unit_test/spy.rbs +0 -8
  199. data/sig/unit_test/type_assertions.rbs +11 -0
  200. data/src/ast.c +491 -143
  201. data/src/lexer.c +1552 -1314
  202. data/src/lexer.re +7 -0
  203. data/src/lexstate.c +8 -1
  204. data/src/location.c +8 -48
  205. data/src/parser.c +1107 -409
  206. data/src/util/rbs_constant_pool.c +0 -4
  207. data/stdlib/bigdecimal/0/big_decimal.rbs +16 -16
  208. data/stdlib/cgi-escape/0/escape.rbs +4 -4
  209. data/stdlib/coverage/0/coverage.rbs +4 -3
  210. data/stdlib/date/0/date.rbs +33 -28
  211. data/stdlib/date/0/date_time.rbs +24 -23
  212. data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
  213. data/stdlib/digest/0/digest.rbs +110 -0
  214. data/stdlib/erb/0/erb.rbs +64 -53
  215. data/stdlib/etc/0/etc.rbs +55 -50
  216. data/stdlib/fileutils/0/fileutils.rbs +140 -126
  217. data/stdlib/forwardable/0/forwardable.rbs +10 -10
  218. data/stdlib/io-console/0/io-console.rbs +2 -2
  219. data/stdlib/json/0/json.rbs +158 -131
  220. data/stdlib/monitor/0/monitor.rbs +3 -3
  221. data/stdlib/net-http/0/net-http.rbs +159 -134
  222. data/stdlib/objspace/0/objspace.rbs +8 -30
  223. data/stdlib/open-uri/0/open-uri.rbs +8 -8
  224. data/stdlib/open3/0/open3.rbs +469 -10
  225. data/stdlib/openssl/0/openssl.rbs +144 -129
  226. data/stdlib/optparse/0/optparse.rbs +23 -14
  227. data/stdlib/pathname/0/pathname.rbs +2 -2
  228. data/stdlib/pp/0/pp.rbs +9 -8
  229. data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
  230. data/stdlib/pstore/0/pstore.rbs +35 -30
  231. data/stdlib/psych/0/psych.rbs +62 -9
  232. data/stdlib/psych/0/store.rbs +2 -4
  233. data/stdlib/pty/0/pty.rbs +9 -6
  234. data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
  235. data/stdlib/rdoc/0/code_object.rbs +2 -1
  236. data/stdlib/rdoc/0/parser.rbs +1 -1
  237. data/stdlib/rdoc/0/store.rbs +1 -1
  238. data/stdlib/ripper/0/ripper.rbs +20 -17
  239. data/stdlib/securerandom/0/manifest.yaml +2 -0
  240. data/stdlib/securerandom/0/securerandom.rbs +7 -20
  241. data/stdlib/shellwords/0/shellwords.rbs +2 -2
  242. data/stdlib/socket/0/addrinfo.rbs +9 -9
  243. data/stdlib/socket/0/basic_socket.rbs +3 -3
  244. data/stdlib/socket/0/ip_socket.rbs +10 -8
  245. data/stdlib/socket/0/socket.rbs +10 -9
  246. data/stdlib/socket/0/tcp_server.rbs +1 -1
  247. data/stdlib/socket/0/tcp_socket.rbs +1 -1
  248. data/stdlib/socket/0/udp_socket.rbs +1 -1
  249. data/stdlib/socket/0/unix_server.rbs +1 -1
  250. data/stdlib/stringio/0/stringio.rbs +55 -54
  251. data/stdlib/strscan/0/string_scanner.rbs +46 -44
  252. data/stdlib/tempfile/0/tempfile.rbs +24 -20
  253. data/stdlib/time/0/time.rbs +7 -5
  254. data/stdlib/tsort/0/tsort.rbs +7 -6
  255. data/stdlib/uri/0/common.rbs +31 -18
  256. data/stdlib/uri/0/file.rbs +2 -2
  257. data/stdlib/uri/0/generic.rbs +9 -2
  258. data/stdlib/uri/0/http.rbs +2 -2
  259. data/stdlib/uri/0/ldap.rbs +2 -2
  260. data/stdlib/uri/0/mailto.rbs +3 -3
  261. data/stdlib/uri/0/rfc2396_parser.rbs +6 -5
  262. data/stdlib/zlib/0/deflate.rbs +4 -3
  263. data/stdlib/zlib/0/gzip_reader.rbs +6 -6
  264. data/stdlib/zlib/0/gzip_writer.rbs +14 -12
  265. data/stdlib/zlib/0/inflate.rbs +1 -1
  266. data/stdlib/zlib/0/need_dict.rbs +1 -1
  267. metadata +66 -3
@@ -14,8 +14,9 @@ class Time
14
14
  # -->
15
15
  # Return the number of seconds the specified time zone differs from UTC.
16
16
  #
17
- # Numeric time zones that include minutes, such as `-10:00` or `+1330` will
18
- # work, as will simpler hour-only time zones like `-10` or `+13`.
17
+ # Numeric time zones that include minutes, such as <code>-10:00</code> or
18
+ # <code>+1330</code> will work, as will simpler hour-only time zones like
19
+ # <code>-10</code> or <code>+13</code>.
19
20
  #
20
21
  # Textual time zones listed in ZoneOffset are also supported.
21
22
  #
@@ -120,9 +121,10 @@ class Time
120
121
  # Based on this fact, this method only understands the time zone abbreviations
121
122
  # described in RFC 822 and the system time zone, in the order named. (i.e. a
122
123
  # definition in RFC 822 overrides the system time zone definition.) The system
123
- # time zone is taken from `Time.local(year, 1, 1).zone` and `Time.local(year, 7,
124
- # 1).zone`. If the extracted time zone abbreviation does not match any of them,
125
- # it is ignored and the given time is regarded as a local time.
124
+ # time zone is taken from <code>Time.local(year, 1, 1).zone</code> and
125
+ # <code>Time.local(year, 7, 1).zone</code>. If the extracted time zone
126
+ # abbreviation does not match any of them, it is ignored and the given time is
127
+ # regarded as a local time.
126
128
  #
127
129
  # ArgumentError is raised if Date._parse cannot extract information from `date`
128
130
  # or if the Time class cannot represent specified date.
@@ -262,9 +262,9 @@ module TSort[Node] : TSort::_Sortable[Node]
262
262
  # - each_strongly_connected_component() { |nodes| ... }
263
263
  # -->
264
264
  # The iterator version of the #strongly_connected_components method.
265
- # *`obj*.each_strongly_connected_component` is similar to
266
- # *`obj*.strongly_connected_components.each`, but modification of *obj* during
267
- # the iteration may lead to unexpected results.
265
+ # <code><em>obj</em>.each_strongly_connected_component</code> is similar to
266
+ # <code><em>obj</em>.strongly_connected_components.each</code>, but modification
267
+ # of *obj* during the iteration may lead to unexpected results.
268
268
  #
269
269
  # #each_strongly_connected_component returns `nil`.
270
270
  #
@@ -382,9 +382,10 @@ module TSort[Node] : TSort::_Sortable[Node]
382
382
  # rdoc-file=lib/tsort.rb
383
383
  # - tsort_each() { |node| ... }
384
384
  # -->
385
- # The iterator version of the #tsort method. *`obj*.tsort_each` is similar to
386
- # *`obj*.tsort.each`, but modification of *obj* during the iteration may lead to
387
- # unexpected results.
385
+ # The iterator version of the #tsort method.
386
+ # <code><em>obj</em>.tsort_each</code> is similar to
387
+ # <code><em>obj</em>.tsort.each</code>, but modification of *obj* during the
388
+ # iteration may lead to unexpected results.
388
389
  #
389
390
  # #tsort_each returns `nil`. If there is a cycle, TSort::Cyclic is raised.
390
391
  #
@@ -119,7 +119,7 @@ module URI
119
119
  # rdoc-file=lib/uri/common.rb
120
120
  # - decode_uri_component(str, enc=Encoding::UTF_8)
121
121
  # -->
122
- # Like URI.decode_www_form_component, except that `'+'` is preserved.
122
+ # Like URI.decode_www_form_component, except that <code>'+'</code> is preserved.
123
123
  #
124
124
  def self.decode_uri_component: (String str, ?encoding enc) -> String
125
125
 
@@ -131,7 +131,8 @@ module URI
131
131
  # ASCII string.
132
132
  #
133
133
  # The method may be used to decode the body of Net::HTTPResponse object `res`
134
- # for which `res['Content-Type']` is `'application/x-www-form-urlencoded'`.
134
+ # for which <code>res['Content-Type']</code> is
135
+ # <code>'application/x-www-form-urlencoded'</code>.
135
136
  #
136
137
  # The returned data is an array of 2-element subarrays; each subarray is a
137
138
  # name/value pair (both are strings). Each returned string has encoding `enc`,
@@ -175,8 +176,10 @@ module URI
175
176
  #
176
177
  # * Preserves:
177
178
  #
178
- # * Characters `'*'`, `'.'`, `'-'`, and `'_'`.
179
- # * Character in ranges `'a'..'z'`, `'A'..'Z'`, and `'0'..'9'`.
179
+ # * Characters <code>'*'</code>, <code>'.'</code>, <code>'-'</code>, and
180
+ # <code>'_'</code>.
181
+ # * Character in ranges <code>'a'..'z'</code>, <code>'A'..'Z'</code>, and
182
+ # <code>'0'..'9'</code>.
180
183
  #
181
184
  # Example:
182
185
  #
@@ -185,7 +188,7 @@ module URI
185
188
  #
186
189
  # * Converts:
187
190
  #
188
- # * Character `'+'` to character `' '`.
191
+ # * Character <code>'+'</code> to character <code>' '</code>.
189
192
  # * Each "percent notation" to an ASCII character.
190
193
  #
191
194
  # Example:
@@ -193,7 +196,7 @@ module URI
193
196
  # URI.decode_www_form_component('Here+are+some+punctuation+characters%3A+%2C%3B%3F%3A')
194
197
  # # => "Here are some punctuation characters: ,;?:"
195
198
  #
196
- # Related: URI.decode_uri_component (preserves `'+'`).
199
+ # Related: URI.decode_uri_component (preserves <code>'+'</code>).
197
200
  #
198
201
  def self.decode_www_form_component: (String str, ?encoding enc) -> String
199
202
 
@@ -201,8 +204,8 @@ module URI
201
204
  # rdoc-file=lib/uri/common.rb
202
205
  # - encode_uri_component(str, enc=nil)
203
206
  # -->
204
- # Like URI.encode_www_form_component, except that `' '` (space) is encoded as
205
- # `'%20'` (instead of `'+'`).
207
+ # Like URI.encode_www_form_component, except that <code>' '</code> (space) is
208
+ # encoded as <code>'%20'</code> (instead of <code>'+'</code>).
206
209
  #
207
210
  def self.encode_uri_component: (String str, ?encoding enc) -> String
208
211
 
@@ -214,10 +217,10 @@ module URI
214
217
  # [Enumerable](rdoc-ref:Enumerable@Enumerable+in+Ruby+Classes) `enum`.
215
218
  #
216
219
  # The result is suitable for use as form data for an HTTP request whose
217
- # `Content-Type` is `'application/x-www-form-urlencoded'`.
220
+ # <code>Content-Type</code> is <code>'application/x-www-form-urlencoded'</code>.
218
221
  #
219
222
  # The returned string consists of the elements of `enum`, each converted to one
220
- # or more URL-encoded strings, and all joined with character `'&'`.
223
+ # or more URL-encoded strings, and all joined with character <code>'&'</code>.
221
224
  #
222
225
  # Simple examples:
223
226
  #
@@ -248,7 +251,8 @@ module URI
248
251
  # URI.encode_www_form([['foo', 0], ['bar', :baz, 'bat']])
249
252
  # # => "foo=0&bar=baz"
250
253
  #
251
- # * If `ele` is an array of one element, the field is formed from `ele[0]`:
254
+ # * If `ele` is an array of one element, the field is formed from
255
+ # <code>ele[0]</code>:
252
256
  #
253
257
  # URI.encode_www_form_component(ele[0])
254
258
  #
@@ -316,8 +320,10 @@ module URI
316
320
  #
317
321
  # * Preserves:
318
322
  #
319
- # * Characters `'*'`, `'.'`, `'-'`, and `'_'`.
320
- # * Character in ranges `'a'..'z'`, `'A'..'Z'`, and `'0'..'9'`.
323
+ # * Characters <code>'*'</code>, <code>'.'</code>, <code>'-'</code>, and
324
+ # <code>'_'</code>.
325
+ # * Character in ranges <code>'a'..'z'</code>, <code>'A'..'Z'</code>, and
326
+ # <code>'0'..'9'</code>.
321
327
  #
322
328
  # Example:
323
329
  #
@@ -326,9 +332,9 @@ module URI
326
332
  #
327
333
  # * Converts:
328
334
  #
329
- # * Character `' '` to character `'+'`.
335
+ # * Character <code>' '</code> to character <code>'+'</code>.
330
336
  # * Any other character to "percent notation"; the percent notation for
331
- # character *c* is `'%%%X' % c.ord`.
337
+ # character *c* is <code>'%%%X' % c.ord</code>.
332
338
  #
333
339
  # Example:
334
340
  #
@@ -343,7 +349,8 @@ module URI
343
349
  #
344
350
  # In either case, the returned string has forced encoding Encoding::US_ASCII.
345
351
  #
346
- # Related: URI.encode_uri_component (encodes `' '` as `'%20'`).
352
+ # Related: URI.encode_uri_component (encodes <code>' '</code> as
353
+ # <code>'%20'</code>).
347
354
  #
348
355
  def self.encode_www_form_component: (_ToS str, ?encoding? enc) -> String
349
356
 
@@ -491,7 +498,8 @@ module URI
491
498
  # Returns a new object constructed from the given `scheme`, `arguments`, and
492
499
  # `default`:
493
500
  #
494
- # * The new object is an instance of `URI.scheme_list[scheme.upcase]`.
501
+ # * The new object is an instance of
502
+ # <code>URI.scheme_list[scheme.upcase]</code>.
495
503
  # * The object is initialized by calling the class initializer using `scheme`
496
504
  # and `arguments`. See URI::Generic.new.
497
505
  #
@@ -560,6 +568,11 @@ URI::REL_URI: Regexp
560
568
 
561
569
  URI::REL_URI_REF: Regexp
562
570
 
571
+ # <!-- rdoc-file=lib/uri/common.rb -->
572
+ # The default parser instance for RFC 2396.
573
+ #
574
+ URI::RFC2396_PARSER: URI::RFC2396_Parser
575
+
563
576
  # <!-- rdoc-file=lib/uri/common.rb -->
564
577
  # The default parser instance for RFC 3986.
565
578
  #
@@ -604,5 +617,5 @@ module Kernel
604
617
  #
605
618
  # You must require 'uri' to use this method.
606
619
  #
607
- def self?.URI: (URI::Generic | String uri) -> URI::Generic
620
+ def self?.URI: (URI::Generic | string uri) -> URI::Generic
608
621
  end
@@ -27,8 +27,8 @@ module URI
27
27
  # The components should be provided either as an Array, or as a Hash with keys
28
28
  # formed by preceding the component names with a colon.
29
29
  #
30
- # If an Array is used, the components must be passed in the order `[host,
31
- # path]`.
30
+ # If an Array is used, the components must be passed in the order <code>[host,
31
+ # path]</code>.
32
32
  #
33
33
  # A path from e.g. the File class should be escaped before being passed.
34
34
  #
@@ -489,8 +489,8 @@ module URI
489
489
  # rdoc-file=lib/uri/generic.rb
490
490
  # - split_userinfo(ui)
491
491
  # -->
492
- # Returns the userinfo `ui` as `[user, password]` if properly formatted as
493
- # 'user:password'.
492
+ # Returns the userinfo `ui` as <code>[user, password]</code> if properly
493
+ # formatted as 'user:password'.
494
494
  #
495
495
  def split_userinfo: (String ui) -> Array[String | nil]
496
496
 
@@ -909,6 +909,13 @@ module URI
909
909
  #
910
910
  def merge: (URI::Generic | string oth) -> URI::Generic
911
911
 
912
+ # <!--
913
+ # rdoc-file=lib/uri/generic.rb
914
+ # - +(oth)
915
+ # -->
916
+ #
917
+ alias + merge
918
+
912
919
  # :stopdoc:
913
920
  def route_from_path: (String src, String dst) -> String
914
921
 
@@ -32,8 +32,8 @@ module URI
32
32
  # The components should be provided either as an Array, or as a Hash with keys
33
33
  # formed by preceding the component names with a colon.
34
34
  #
35
- # If an Array is used, the components must be passed in the order `[userinfo,
36
- # host, port, path, query, fragment]`.
35
+ # If an Array is used, the components must be passed in the order
36
+ # <code>[userinfo, host, port, path, query, fragment]</code>.
37
37
  #
38
38
  # Example:
39
39
  #
@@ -38,8 +38,8 @@ module URI
38
38
  # The components should be provided either as an Array, or as a Hash with keys
39
39
  # formed by preceding the component names with a colon.
40
40
  #
41
- # If an Array is used, the components must be passed in the order `[host, port,
42
- # dn, attributes, scope, filter, extensions]`.
41
+ # If an Array is used, the components must be passed in the order <code>[host,
42
+ # port, dn, attributes, scope, filter, extensions]</code>.
43
43
  #
44
44
  # Example:
45
45
  #
@@ -15,13 +15,13 @@ module URI
15
15
  # Creates a new URI::MailTo object from components, with syntax checking.
16
16
  #
17
17
  # Components can be provided as an Array or Hash. If an Array is used, the
18
- # components must be supplied as `[to, headers]`.
18
+ # components must be supplied as <code>[to, headers]</code>.
19
19
  #
20
20
  # If a Hash is used, the keys are the component names preceded by colons.
21
21
  #
22
22
  # The headers can be supplied as a pre-encoded string, such as
23
- # `"subject=subscribe&cc=address"`, or as an Array of Arrays like `[['subject',
24
- # 'subscribe'], ['cc', 'address']]`.
23
+ # <code>"subject=subscribe&cc=address"</code>, or as an Array of Arrays like
24
+ # <code>[['subject', 'subscribe'], ['cc', 'address']]</code>.
25
25
  #
26
26
  # Examples:
27
27
  #
@@ -75,7 +75,7 @@ module URI
75
75
  # : String to make safe
76
76
  #
77
77
  # `unsafe`
78
- # : Regexp to apply. Defaults to `self.regexp[:UNSAFE]`
78
+ # : Regexp to apply. Defaults to <code>self.regexp[:UNSAFE]</code>
79
79
  #
80
80
  #
81
81
  # ## Description
@@ -130,8 +130,9 @@ module URI
130
130
  # rdoc-file=lib/uri/rfc2396_parser.rb
131
131
  # - make_regexp(schemes = nil)
132
132
  # -->
133
- # Returns Regexp that is default `self.regexp[:ABS_URI_REF]`, unless `schemes`
134
- # is provided. Then it is a Regexp.union with `self.pattern[:X_ABS_URI]`.
133
+ # Returns Regexp that is default <code>self.regexp[:ABS_URI_REF]</code>, unless
134
+ # `schemes` is provided. Then it is a Regexp.union with
135
+ # <code>self.pattern[:X_ABS_URI]</code>.
135
136
  #
136
137
  def make_regexp: (?Array[String] schemes) -> Regexp
137
138
 
@@ -161,7 +162,7 @@ module URI
161
162
  # rdoc-file=lib/uri/rfc2396_parser.rb
162
163
  # - split(uri)
163
164
  # -->
164
- # Returns a split URI against `regexp[:ABS_URI]`.
165
+ # Returns a split URI against <code>regexp[:ABS_URI]</code>.
165
166
  #
166
167
  def split: (String uri) -> [ String?, String?, String?, String?, String?, String?, String?, String?, String? ]
167
168
 
@@ -176,7 +177,7 @@ module URI
176
177
  # : String to remove escapes from
177
178
  #
178
179
  # `escaped`
179
- # : Regexp to apply. Defaults to `self.regexp[:ESCAPED]`
180
+ # : Regexp to apply. Defaults to <code>self.regexp[:ESCAPED]</code>
180
181
  #
181
182
  #
182
183
  # ## Description
@@ -78,9 +78,10 @@ module Zlib
78
78
  # - flush(flush = Zlib::SYNC_FLUSH) -> String
79
79
  # - flush(flush = Zlib::SYNC_FLUSH) { |chunk| ... } -> nil
80
80
  # -->
81
- # This method is equivalent to `deflate('', flush)`. This method is just
82
- # provided to improve the readability of your Ruby program. If a block is given
83
- # chunks of deflate output are yielded to the block until the buffer is flushed.
81
+ # This method is equivalent to <code>deflate('', flush)</code>. This method is
82
+ # just provided to improve the readability of your Ruby program. If a block is
83
+ # given chunks of deflate output are yielded to the block until the buffer is
84
+ # flushed.
84
85
  #
85
86
  # See Zlib::Deflate#deflate for detail on the `flush` constants NO_FLUSH,
86
87
  # SYNC_FLUSH, FULL_FLUSH and FINISH.
@@ -35,8 +35,8 @@ module Zlib
35
35
  # Be careful of the footer of the gzip file. A gzip file has the checksum of
36
36
  # pre-compressed data in its footer. GzipReader checks all uncompressed data
37
37
  # against that checksum at the following cases, and if it fails, raises
38
- # `Zlib::GzipFile::NoFooter`, `Zlib::GzipFile::CRCError`, or
39
- # `Zlib::GzipFile::LengthError` exception.
38
+ # <code>Zlib::GzipFile::NoFooter</code>, <code>Zlib::GzipFile::CRCError</code>,
39
+ # or <code>Zlib::GzipFile::LengthError</code> exception.
40
40
  #
41
41
  # * When an reading request is received beyond the end of file (the end of
42
42
  # compressed data). That is, when Zlib::GzipReader#read,
@@ -62,8 +62,8 @@ module Zlib
62
62
  # GzipReader object associated with that file. Further details of this method
63
63
  # are in Zlib::GzipReader.new and ZLib::GzipFile.wrap.
64
64
  #
65
- def self.open: (String | _ToPath filename) -> instance
66
- | (String | _ToPath filename) { (instance gz) -> void } -> void
65
+ def self.open: (path filename) -> instance
66
+ | (path filename) { (instance gz) -> void } -> void
67
67
 
68
68
  # <!--
69
69
  # rdoc-file=ext/zlib/zlib.c
@@ -282,8 +282,8 @@ module Zlib
282
282
  # `read` method that behaves same as the IO#read.
283
283
  #
284
284
  # The `options` hash may be used to set the encoding of the data.
285
- # `:external_encoding`, `:internal_encoding` and `:encoding` may be set as in
286
- # IO::new.
285
+ # <code>:external_encoding</code>, <code>:internal_encoding</code> and
286
+ # <code>:encoding</code> may be set as in IO::new.
287
287
  #
288
288
  # If the gzip file header is incorrect, raises an Zlib::GzipFile::Error
289
289
  # exception.
@@ -38,7 +38,8 @@ module Zlib
38
38
  # returns a GzipWriter object associated with that file. Further details of
39
39
  # this method are found in Zlib::GzipWriter.new and Zlib::GzipFile.wrap.
40
40
  #
41
- def self.open: (String filename) { (instance gz) -> void } -> instance
41
+ def self.open: (String filename, ?Integer level, ?Integer strategy, **untyped opts) -> instance
42
+ | (String filename, ?Integer level, ?Integer strategy, **untyped opts) { (instance gz) -> void } -> nil
42
43
 
43
44
  # <!--
44
45
  # rdoc-file=ext/zlib/zlib.c
@@ -61,10 +62,11 @@ module Zlib
61
62
  # - flush(flush=nil)
62
63
  # -->
63
64
  # Flushes all the internal buffers of the GzipWriter object. The meaning of
64
- # `flush` is same as in Zlib::Deflate#deflate. `Zlib::SYNC_FLUSH` is used if
65
- # `flush` is omitted. It is no use giving flush `Zlib::NO_FLUSH`.
65
+ # `flush` is same as in Zlib::Deflate#deflate. <code>Zlib::SYNC_FLUSH</code> is
66
+ # used if `flush` is omitted. It is no use giving flush
67
+ # <code>Zlib::NO_FLUSH</code>.
66
68
  #
67
- def flush: (?Integer flush) -> String
69
+ def flush: (?Integer flush) -> self
68
70
 
69
71
  # <!--
70
72
  # rdoc-file=ext/zlib/zlib.c
@@ -74,16 +76,16 @@ module Zlib
74
76
  #
75
77
  # Setting the mtime in the gzip header does not effect the mtime of the file
76
78
  # generated. Different utilities that expand the gzipped files may use the mtime
77
- # header. For example the gunzip utility can use the `-N` flag which will set
78
- # the resultant file's mtime to the value in the header. By default many tools
79
- # will set the mtime of the expanded file to the mtime of the gzipped file, not
80
- # the mtime in the header.
79
+ # header. For example the gunzip utility can use the <code>-N</code> flag which
80
+ # will set the resultant file's mtime to the value in the header. By default
81
+ # many tools will set the mtime of the expanded file to the mtime of the gzipped
82
+ # file, not the mtime in the header.
81
83
  #
82
84
  # If you do not set an mtime, the default value will be the time when
83
85
  # compression started. Setting a value of 0 indicates no time stamp is
84
86
  # available.
85
87
  #
86
- def mtime=: (string | _ToPath | IO file_name) -> Time
88
+ def mtime=: (Time | Integer) -> void
87
89
 
88
90
  # <!--
89
91
  # rdoc-file=ext/zlib/zlib.c
@@ -158,9 +160,9 @@ module Zlib
158
160
  # that behaves the same as IO#write.
159
161
  #
160
162
  # The `options` hash may be used to set the encoding of the data.
161
- # `:external_encoding`, `:internal_encoding` and `:encoding` may be set as in
162
- # IO::new.
163
+ # <code>:external_encoding</code>, <code>:internal_encoding</code> and
164
+ # <code>:encoding</code> may be set as in IO::new.
163
165
  #
164
- def initialize: (_Writer io, Integer level, Integer strategy, **untyped opts) -> void
166
+ def initialize: (_Writer io, ?Integer? level, ?Integer? strategy, **untyped opts) -> void
165
167
  end
166
168
  end
@@ -123,7 +123,7 @@ module Zlib
123
123
  #
124
124
  # What is this?
125
125
  #
126
- # `:)`
126
+ # <code>:)</code>
127
127
  #
128
128
  def sync_point?: () -> bool
129
129
 
@@ -6,7 +6,7 @@ module Zlib
6
6
  # When zlib returns a Z_NEED_DICT if a preset dictionary is needed at this
7
7
  # point.
8
8
  #
9
- # Used by Zlib::Inflate.inflate and `Zlib.inflate`
9
+ # Used by Zlib::Inflate.inflate and <code>Zlib.inflate</code>
10
10
  #
11
11
  class NeedDict < Zlib::Error
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.4
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
@@ -23,6 +23,20 @@ dependencies:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: '0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: prism
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.6.0
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 1.6.0
26
40
  - !ruby/object:Gem::Dependency
27
41
  name: tsort
28
42
  requirement: !ruby/object:Gem::Requirement
@@ -50,14 +64,18 @@ files:
50
64
  - ".clang-format"
51
65
  - ".clangd"
52
66
  - ".github/dependabot.yml"
67
+ - ".github/workflows/bundle-update.yml"
53
68
  - ".github/workflows/c-check.yml"
54
69
  - ".github/workflows/comments.yml"
55
70
  - ".github/workflows/dependabot.yml"
56
71
  - ".github/workflows/ruby.yml"
72
+ - ".github/workflows/rust.yml"
57
73
  - ".github/workflows/typecheck.yml"
58
74
  - ".github/workflows/windows.yml"
59
75
  - ".gitignore"
60
76
  - ".rubocop.yml"
77
+ - ".vscode/extensions.json"
78
+ - ".vscode/settings.json"
61
79
  - BSDL
62
80
  - CHANGELOG.md
63
81
  - COPYING
@@ -78,6 +96,7 @@ files:
78
96
  - core/encoding.rbs
79
97
  - core/enumerable.rbs
80
98
  - core/enumerator.rbs
99
+ - core/enumerator/arithmetic_sequence.rbs
81
100
  - core/enumerator/product.rbs
82
101
  - core/env.rbs
83
102
  - core/errno.rbs
@@ -117,6 +136,7 @@ files:
117
136
  - core/rb_config.rbs
118
137
  - core/rbs/unnamed/argf.rbs
119
138
  - core/rbs/unnamed/env_class.rbs
139
+ - core/rbs/unnamed/main_class.rbs
120
140
  - core/rbs/unnamed/random.rbs
121
141
  - core/refinement.rbs
122
142
  - core/regexp.rbs
@@ -153,15 +173,18 @@ files:
153
173
  - docs/aliases.md
154
174
  - docs/architecture.md
155
175
  - docs/collection.md
176
+ - docs/config.md
156
177
  - docs/data_and_struct.md
157
178
  - docs/encoding.md
158
179
  - docs/gem.md
180
+ - docs/inline.md
159
181
  - docs/rbs_by_example.md
160
182
  - docs/repo.md
161
183
  - docs/sigs.md
162
184
  - docs/stdlib.md
163
185
  - docs/syntax.md
164
186
  - docs/tools.md
187
+ - docs/type_fingerprint.md
165
188
  - exe/rbs
166
189
  - ext/rbs_extension/ast_translation.c
167
190
  - ext/rbs_extension/ast_translation.h
@@ -201,6 +224,12 @@ files:
201
224
  - lib/rbs/ast/declarations.rb
202
225
  - lib/rbs/ast/directives.rb
203
226
  - lib/rbs/ast/members.rb
227
+ - lib/rbs/ast/ruby/annotations.rb
228
+ - lib/rbs/ast/ruby/comment_block.rb
229
+ - lib/rbs/ast/ruby/declarations.rb
230
+ - lib/rbs/ast/ruby/helpers/constant_helper.rb
231
+ - lib/rbs/ast/ruby/helpers/location_helper.rb
232
+ - lib/rbs/ast/ruby/members.rb
204
233
  - lib/rbs/ast/type_param.rb
205
234
  - lib/rbs/ast/visitor.rb
206
235
  - lib/rbs/buffer.rb
@@ -228,12 +257,16 @@ files:
228
257
  - lib/rbs/definition_builder/method_builder.rb
229
258
  - lib/rbs/diff.rb
230
259
  - lib/rbs/environment.rb
260
+ - lib/rbs/environment/class_entry.rb
261
+ - lib/rbs/environment/module_entry.rb
231
262
  - lib/rbs/environment/use_map.rb
232
263
  - lib/rbs/environment_loader.rb
233
264
  - lib/rbs/environment_walker.rb
234
265
  - lib/rbs/errors.rb
235
266
  - lib/rbs/factory.rb
236
267
  - lib/rbs/file_finder.rb
268
+ - lib/rbs/inline_parser.rb
269
+ - lib/rbs/inline_parser/comment_association.rb
237
270
  - lib/rbs/location_aux.rb
238
271
  - lib/rbs/locator.rb
239
272
  - lib/rbs/method_type.rb
@@ -253,6 +286,7 @@ files:
253
286
  - lib/rbs/resolver/constant_resolver.rb
254
287
  - lib/rbs/resolver/type_name_resolver.rb
255
288
  - lib/rbs/sorter.rb
289
+ - lib/rbs/source.rb
256
290
  - lib/rbs/substitution.rb
257
291
  - lib/rbs/subtractor.rb
258
292
  - lib/rbs/test.rb
@@ -281,6 +315,22 @@ files:
281
315
  - lib/rdoc/discover.rb
282
316
  - lib/rdoc_plugin/parser.rb
283
317
  - rbs.gemspec
318
+ - rust/.gitignore
319
+ - rust/Cargo.lock
320
+ - rust/Cargo.toml
321
+ - rust/ruby-rbs-sys/Cargo.toml
322
+ - rust/ruby-rbs-sys/build.rs
323
+ - rust/ruby-rbs-sys/src/lib.rs
324
+ - rust/ruby-rbs-sys/vendor/rbs/include
325
+ - rust/ruby-rbs-sys/vendor/rbs/src
326
+ - rust/ruby-rbs-sys/wrapper.h
327
+ - rust/ruby-rbs/Cargo.toml
328
+ - rust/ruby-rbs/build.rs
329
+ - rust/ruby-rbs/examples/locations.rs
330
+ - rust/ruby-rbs/src/lib.rs
331
+ - rust/ruby-rbs/src/node/mod.rs
332
+ - rust/ruby-rbs/tests/sanity.rs
333
+ - rust/ruby-rbs/vendor/rbs/config.yml
284
334
  - schema/annotation.json
285
335
  - schema/comment.json
286
336
  - schema/decls.json
@@ -297,6 +347,12 @@ files:
297
347
  - sig/annotate/rdoc_annotater.rbs
298
348
  - sig/annotate/rdoc_source.rbs
299
349
  - sig/annotation.rbs
350
+ - sig/ast/ruby/annotations.rbs
351
+ - sig/ast/ruby/comment_block.rbs
352
+ - sig/ast/ruby/declarations.rbs
353
+ - sig/ast/ruby/helpers/constant_helper.rbs
354
+ - sig/ast/ruby/helpers/location_helper.rbs
355
+ - sig/ast/ruby/members.rbs
300
356
  - sig/buffer.rbs
301
357
  - sig/builtin_names.rbs
302
358
  - sig/cli.rbs
@@ -318,11 +374,15 @@ files:
318
374
  - sig/diff.rbs
319
375
  - sig/directives.rbs
320
376
  - sig/environment.rbs
377
+ - sig/environment/class_entry.rbs
378
+ - sig/environment/module_entry.rbs
321
379
  - sig/environment_loader.rbs
322
380
  - sig/environment_walker.rbs
323
381
  - sig/errors.rbs
324
382
  - sig/factory.rbs
325
383
  - sig/file_finder.rbs
384
+ - sig/inline_parser.rbs
385
+ - sig/inline_parser/comment_association.rbs
326
386
  - sig/location.rbs
327
387
  - sig/locator.rbs
328
388
  - sig/manifest.yaml
@@ -346,6 +406,7 @@ files:
346
406
  - sig/shims/enumerable.rbs
347
407
  - sig/shims/rubygems.rbs
348
408
  - sig/sorter.rbs
409
+ - sig/source.rbs
349
410
  - sig/substitution.rbs
350
411
  - sig/subtractor.rbs
351
412
  - sig/test.rbs
@@ -485,6 +546,7 @@ files:
485
546
  - stdlib/psych/0/psych.rbs
486
547
  - stdlib/psych/0/store.rbs
487
548
  - stdlib/pty/0/pty.rbs
549
+ - stdlib/random-formatter/0/random-formatter.rbs
488
550
  - stdlib/rdoc/0/code_object.rbs
489
551
  - stdlib/rdoc/0/comment.rbs
490
552
  - stdlib/rdoc/0/context.rbs
@@ -498,6 +560,7 @@ files:
498
560
  - stdlib/resolv/0/manifest.yaml
499
561
  - stdlib/resolv/0/resolv.rbs
500
562
  - stdlib/ripper/0/ripper.rbs
563
+ - stdlib/securerandom/0/manifest.yaml
501
564
  - stdlib/securerandom/0/securerandom.rbs
502
565
  - stdlib/shellwords/0/shellwords.rbs
503
566
  - stdlib/singleton/0/singleton.rbs
@@ -570,14 +633,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
570
633
  requirements:
571
634
  - - ">="
572
635
  - !ruby/object:Gem::Version
573
- version: '3.1'
636
+ version: '3.2'
574
637
  required_rubygems_version: !ruby/object:Gem::Requirement
575
638
  requirements:
576
639
  - - ">="
577
640
  - !ruby/object:Gem::Version
578
641
  version: '0'
579
642
  requirements: []
580
- rubygems_version: 4.0.6
643
+ rubygems_version: 4.0.3
581
644
  specification_version: 4
582
645
  summary: Type signature for Ruby.
583
646
  test_files: []