rbs 2.8.4 → 3.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (434) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +12 -4
  3. data/.github/workflows/comments.yml +11 -11
  4. data/.github/workflows/dependabot.yml +30 -0
  5. data/.github/workflows/ruby.yml +40 -49
  6. data/.github/workflows/typecheck.yml +36 -0
  7. data/.github/workflows/windows.yml +28 -0
  8. data/.gitignore +1 -0
  9. data/.rubocop.yml +42 -2
  10. data/CHANGELOG.md +845 -1
  11. data/README.md +64 -4
  12. data/Rakefile +198 -18
  13. data/Steepfile +11 -11
  14. data/config.yml +311 -0
  15. data/core/array.rbs +2189 -1914
  16. data/core/basic_object.rbs +59 -84
  17. data/core/binding.rbs +7 -69
  18. data/core/builtin.rbs +210 -11
  19. data/core/class.rbs +37 -0
  20. data/core/comparable.rbs +23 -25
  21. data/core/complex.rbs +449 -227
  22. data/core/constants.rbs +29 -21
  23. data/core/data.rbs +415 -0
  24. data/core/dir.rbs +698 -415
  25. data/core/encoding.rbs +468 -843
  26. data/core/enumerable.rbs +495 -455
  27. data/core/enumerator/product.rbs +92 -0
  28. data/core/enumerator.rbs +106 -9
  29. data/core/env.rbs +1 -1
  30. data/core/errno.rbs +506 -605
  31. data/core/errors.rbs +15 -17
  32. data/core/exception.rbs +361 -145
  33. data/core/false_class.rbs +39 -26
  34. data/core/fiber.rbs +121 -14
  35. data/core/file.rbs +1262 -320
  36. data/core/file_test.rbs +62 -45
  37. data/core/float.rbs +187 -208
  38. data/core/gc.rbs +446 -196
  39. data/core/global_variables.rbs +29 -29
  40. data/core/hash.rbs +242 -349
  41. data/core/integer.rbs +246 -308
  42. data/core/io/buffer.rbs +373 -122
  43. data/core/io/wait.rbs +29 -17
  44. data/core/io.rbs +1881 -1518
  45. data/core/kernel.rbs +2116 -1538
  46. data/core/marshal.rbs +24 -14
  47. data/core/match_data.rbs +413 -166
  48. data/core/math.rbs +531 -291
  49. data/core/method.rbs +101 -32
  50. data/core/module.rbs +228 -64
  51. data/core/nil_class.rbs +106 -47
  52. data/core/numeric.rbs +206 -292
  53. data/core/object.rbs +73 -1168
  54. data/core/object_space/weak_key_map.rbs +166 -0
  55. data/core/object_space.rbs +5 -3
  56. data/core/proc.rbs +280 -39
  57. data/core/process.rbs +1318 -658
  58. data/core/ractor.rbs +200 -134
  59. data/core/random.rbs +21 -4
  60. data/core/range.rbs +309 -153
  61. data/core/rational.rbs +4 -12
  62. data/core/rb_config.rbs +64 -43
  63. data/core/rbs/unnamed/argf.rbs +411 -147
  64. data/core/rbs/unnamed/env_class.rbs +137 -253
  65. data/core/rbs/unnamed/random.rbs +49 -26
  66. data/core/refinement.rbs +16 -1
  67. data/core/regexp.rbs +1568 -862
  68. data/core/ruby_vm.rbs +719 -7
  69. data/core/rubygems/config_file.rbs +3 -0
  70. data/core/rubygems/errors.rbs +69 -6
  71. data/core/rubygems/rubygems.rbs +71 -17
  72. data/core/rubygems/version.rbs +11 -7
  73. data/{stdlib/set/0 → core}/set.rbs +80 -91
  74. data/core/signal.rbs +14 -8
  75. data/core/string.rbs +1732 -1607
  76. data/core/struct.rbs +467 -95
  77. data/core/symbol.rbs +215 -245
  78. data/core/thread.rbs +133 -89
  79. data/core/thread_group.rbs +9 -9
  80. data/core/time.rbs +1141 -841
  81. data/core/trace_point.rbs +181 -121
  82. data/core/true_class.rbs +58 -32
  83. data/core/unbound_method.rbs +103 -30
  84. data/core/warning.rbs +50 -5
  85. data/docs/CONTRIBUTING.md +1 -1
  86. data/docs/architecture.md +110 -0
  87. data/docs/collection.md +59 -5
  88. data/docs/data_and_struct.md +86 -0
  89. data/docs/gem.md +57 -0
  90. data/docs/rbs_by_example.md +16 -35
  91. data/docs/repo.md +1 -1
  92. data/docs/sigs.md +7 -7
  93. data/docs/stdlib.md +63 -5
  94. data/docs/syntax.md +255 -61
  95. data/docs/tools.md +1 -0
  96. data/ext/rbs_extension/extconf.rb +10 -0
  97. data/ext/rbs_extension/lexer.c +1741 -1548
  98. data/ext/rbs_extension/lexer.h +11 -1
  99. data/ext/rbs_extension/lexer.re +12 -6
  100. data/ext/rbs_extension/lexstate.c +26 -3
  101. data/ext/rbs_extension/location.c +119 -111
  102. data/ext/rbs_extension/location.h +32 -7
  103. data/ext/rbs_extension/main.c +3 -0
  104. data/ext/rbs_extension/parser.c +883 -481
  105. data/ext/rbs_extension/parserstate.c +65 -25
  106. data/ext/rbs_extension/parserstate.h +13 -3
  107. data/ext/rbs_extension/rbs_extension.h +1 -10
  108. data/ext/rbs_extension/unescape.c +7 -47
  109. data/goodcheck.yml +2 -2
  110. data/{ext/rbs_extension → include/rbs}/constants.h +26 -15
  111. data/include/rbs/ruby_objs.h +72 -0
  112. data/include/rbs.h +7 -0
  113. data/lib/rbs/annotate/annotations.rb +3 -3
  114. data/lib/rbs/annotate/formatter.rb +13 -3
  115. data/lib/rbs/annotate/rdoc_annotator.rb +1 -1
  116. data/lib/rbs/annotate/rdoc_source.rb +12 -3
  117. data/lib/rbs/ast/declarations.rb +85 -2
  118. data/lib/rbs/ast/directives.rb +39 -0
  119. data/lib/rbs/ast/members.rb +49 -15
  120. data/lib/rbs/ast/type_param.rb +104 -15
  121. data/lib/rbs/ast/visitor.rb +137 -0
  122. data/lib/rbs/buffer.rb +5 -0
  123. data/lib/rbs/cli/colored_io.rb +48 -0
  124. data/lib/rbs/cli/diff.rb +83 -0
  125. data/lib/rbs/cli/validate.rb +356 -0
  126. data/lib/rbs/cli.rb +253 -143
  127. data/lib/rbs/collection/cleaner.rb +8 -1
  128. data/lib/rbs/collection/config/lockfile.rb +92 -0
  129. data/lib/rbs/collection/config/lockfile_generator.rb +154 -65
  130. data/lib/rbs/collection/config.rb +19 -46
  131. data/lib/rbs/collection/installer.rb +12 -13
  132. data/lib/rbs/collection/sources/base.rb +2 -2
  133. data/lib/rbs/collection/sources/git.rb +146 -69
  134. data/lib/rbs/collection/sources/local.rb +81 -0
  135. data/lib/rbs/collection/sources/rubygems.rb +10 -12
  136. data/lib/rbs/collection/sources/stdlib.rb +14 -13
  137. data/lib/rbs/collection/sources.rb +15 -2
  138. data/lib/rbs/collection.rb +2 -1
  139. data/lib/rbs/definition.rb +13 -16
  140. data/lib/rbs/definition_builder/ancestor_builder.rb +100 -24
  141. data/lib/rbs/definition_builder/method_builder.rb +4 -4
  142. data/lib/rbs/definition_builder.rb +489 -584
  143. data/lib/rbs/diff.rb +125 -0
  144. data/lib/rbs/environment/use_map.rb +77 -0
  145. data/lib/rbs/environment.rb +406 -105
  146. data/lib/rbs/environment_loader.rb +48 -44
  147. data/lib/rbs/environment_walker.rb +1 -1
  148. data/lib/rbs/errors.rb +175 -56
  149. data/lib/rbs/file_finder.rb +28 -0
  150. data/lib/rbs/location_aux.rb +8 -7
  151. data/lib/rbs/locator.rb +37 -15
  152. data/lib/rbs/method_type.rb +23 -0
  153. data/lib/rbs/namespace.rb +1 -0
  154. data/lib/rbs/parser/lex_result.rb +15 -0
  155. data/lib/rbs/parser/token.rb +23 -0
  156. data/lib/rbs/parser_aux.rb +22 -13
  157. data/lib/rbs/prototype/helpers.rb +48 -22
  158. data/lib/rbs/prototype/node_usage.rb +99 -0
  159. data/lib/rbs/prototype/rb.rb +125 -31
  160. data/lib/rbs/prototype/rbi.rb +49 -36
  161. data/lib/rbs/prototype/runtime/helpers.rb +59 -0
  162. data/lib/rbs/prototype/runtime/reflection.rb +19 -0
  163. data/lib/rbs/prototype/runtime/value_object_generator.rb +279 -0
  164. data/lib/rbs/prototype/runtime.rb +273 -159
  165. data/lib/rbs/resolver/constant_resolver.rb +24 -8
  166. data/lib/rbs/resolver/type_name_resolver.rb +41 -7
  167. data/lib/rbs/sorter.rb +153 -123
  168. data/lib/rbs/substitution.rb +19 -0
  169. data/lib/rbs/subtractor.rb +201 -0
  170. data/lib/rbs/test/errors.rb +24 -11
  171. data/lib/rbs/test/guaranteed.rb +30 -0
  172. data/lib/rbs/test/hook.rb +45 -40
  173. data/lib/rbs/test/setup.rb +1 -1
  174. data/lib/rbs/test/tester.rb +1 -1
  175. data/lib/rbs/test/type_check.rb +120 -23
  176. data/lib/rbs/test.rb +6 -3
  177. data/lib/rbs/type_alias_dependency.rb +13 -3
  178. data/lib/rbs/type_alias_regularity.rb +21 -14
  179. data/lib/rbs/type_name.rb +18 -13
  180. data/lib/rbs/types.rb +352 -18
  181. data/lib/rbs/unit_test/convertibles.rb +176 -0
  182. data/lib/rbs/unit_test/spy.rb +136 -0
  183. data/lib/rbs/unit_test/type_assertions.rb +341 -0
  184. data/lib/rbs/unit_test/with_aliases.rb +143 -0
  185. data/lib/rbs/unit_test.rb +6 -0
  186. data/lib/rbs/validator.rb +55 -30
  187. data/lib/rbs/variance_calculator.rb +26 -23
  188. data/lib/rbs/vendorer.rb +3 -3
  189. data/lib/rbs/version.rb +1 -1
  190. data/lib/rbs/writer.rb +69 -22
  191. data/lib/rbs.rb +7 -2
  192. data/lib/rdoc/discover.rb +1 -1
  193. data/lib/rdoc_plugin/parser.rb +5 -5
  194. data/rbs.gemspec +12 -2
  195. data/schema/decls.json +1 -1
  196. data/schema/members.json +15 -10
  197. data/sig/ancestor_builder.rbs +4 -0
  198. data/sig/ancestor_graph.rbs +22 -2
  199. data/sig/annotate/formatter.rbs +2 -2
  200. data/sig/annotate/rdoc_annotater.rbs +1 -1
  201. data/sig/cli/colored_io.rbs +15 -0
  202. data/sig/cli/diff.rbs +21 -0
  203. data/sig/cli/validate.rbs +43 -0
  204. data/sig/cli.rbs +4 -0
  205. data/sig/collection/config/lockfile.rbs +74 -0
  206. data/sig/collection/config/lockfile_generator.rbs +66 -0
  207. data/sig/collection/config.rbs +5 -48
  208. data/sig/collection/installer.rbs +1 -1
  209. data/sig/collection/sources.rbs +105 -33
  210. data/sig/constant.rbs +1 -1
  211. data/sig/declarations.rbs +42 -3
  212. data/sig/definition.rbs +26 -10
  213. data/sig/definition_builder.rbs +103 -81
  214. data/sig/diff.rbs +28 -0
  215. data/sig/directives.rbs +61 -0
  216. data/sig/environment.rbs +175 -29
  217. data/sig/environment_loader.rbs +20 -18
  218. data/sig/errors.rbs +123 -2
  219. data/sig/file_finder.rbs +28 -0
  220. data/sig/location.rbs +0 -3
  221. data/sig/locator.rbs +14 -2
  222. data/sig/manifest.yaml +0 -1
  223. data/sig/members.rbs +32 -9
  224. data/sig/method_types.rbs +10 -4
  225. data/sig/namespace.rbs +2 -3
  226. data/sig/parser.rbs +55 -16
  227. data/sig/prototype/helpers.rbs +4 -0
  228. data/sig/prototype/node_usage.rbs +20 -0
  229. data/sig/prototype/rb.rbs +10 -2
  230. data/sig/prototype/rbi.rbs +2 -0
  231. data/sig/prototype/runtime.rbs +182 -0
  232. data/sig/rbs.rbs +1 -1
  233. data/sig/rdoc/rbs.rbs +4 -0
  234. data/sig/repository.rbs +7 -5
  235. data/sig/resolver/constant_resolver.rbs +3 -4
  236. data/sig/resolver/context.rbs +1 -1
  237. data/sig/resolver/type_name_resolver.rbs +5 -1
  238. data/sig/shims/bundler.rbs +38 -0
  239. data/sig/shims/rubygems.rbs +19 -0
  240. data/sig/sorter.rbs +23 -5
  241. data/sig/substitution.rbs +6 -0
  242. data/sig/subtractor.rbs +37 -0
  243. data/sig/test/errors.rbs +52 -0
  244. data/sig/test/guranteed.rbs +9 -0
  245. data/sig/test/type_check.rbs +19 -0
  246. data/sig/test.rbs +82 -0
  247. data/sig/type_alias_dependency.rbs +31 -0
  248. data/sig/type_alias_regularity.rbs +12 -6
  249. data/sig/type_param.rbs +45 -9
  250. data/sig/typename.rbs +8 -5
  251. data/sig/types.rbs +119 -12
  252. data/sig/unit_test/convertibles.rbs +154 -0
  253. data/sig/unit_test/spy.rbs +28 -0
  254. data/sig/unit_test/type_assertions.rbs +194 -0
  255. data/sig/unit_test/with_aliases.rbs +136 -0
  256. data/sig/use_map.rbs +35 -0
  257. data/sig/validator.rbs +12 -5
  258. data/sig/variance_calculator.rbs +3 -1
  259. data/sig/vendorer.rbs +1 -1
  260. data/sig/visitor.rbs +47 -0
  261. data/sig/writer.rbs +6 -2
  262. data/src/constants.c +153 -0
  263. data/src/ruby_objs.c +793 -0
  264. data/stdlib/base64/0/base64.rbs +298 -45
  265. data/stdlib/benchmark/0/benchmark.rbs +12 -3
  266. data/stdlib/bigdecimal/0/big_decimal.rbs +62 -198
  267. data/stdlib/cgi/0/core.rbs +68 -15
  268. data/stdlib/cgi/0/manifest.yaml +1 -0
  269. data/stdlib/coverage/0/coverage.rbs +50 -11
  270. data/stdlib/csv/0/csv.rbs +90 -119
  271. data/stdlib/csv/0/manifest.yaml +1 -0
  272. data/stdlib/date/0/date.rbs +806 -735
  273. data/stdlib/date/0/date_time.rbs +70 -211
  274. data/stdlib/dbm/0/dbm.rbs +0 -2
  275. data/stdlib/delegate/0/delegator.rbs +184 -0
  276. data/stdlib/delegate/0/kernel.rbs +47 -0
  277. data/stdlib/delegate/0/simple_delegator.rbs +96 -0
  278. data/stdlib/did_you_mean/0/did_you_mean.rbs +3 -8
  279. data/stdlib/digest/0/digest.rbs +48 -35
  280. data/stdlib/erb/0/erb.rbs +15 -39
  281. data/stdlib/etc/0/etc.rbs +174 -54
  282. data/stdlib/fileutils/0/fileutils.rbs +1234 -385
  283. data/stdlib/forwardable/0/forwardable.rbs +4 -4
  284. data/stdlib/io-console/0/io-console.rbs +82 -17
  285. data/stdlib/ipaddr/0/ipaddr.rbs +11 -6
  286. data/stdlib/json/0/json.rbs +434 -151
  287. data/stdlib/kconv/0/kconv.rbs +166 -0
  288. data/stdlib/logger/0/formatter.rbs +0 -2
  289. data/stdlib/logger/0/log_device.rbs +1 -3
  290. data/stdlib/logger/0/logger.rbs +465 -328
  291. data/stdlib/minitest/0/kernel.rbs +2 -2
  292. data/stdlib/minitest/0/minitest/abstract_reporter.rbs +4 -1
  293. data/stdlib/minitest/0/minitest/assertion.rbs +1 -0
  294. data/stdlib/minitest/0/minitest/assertions.rbs +58 -13
  295. data/stdlib/minitest/0/minitest/backtrace_filter.rbs +7 -0
  296. data/stdlib/minitest/0/minitest/bench_spec.rbs +8 -8
  297. data/stdlib/minitest/0/minitest/benchmark.rbs +17 -16
  298. data/stdlib/minitest/0/minitest/compress.rbs +13 -0
  299. data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
  300. data/stdlib/minitest/0/minitest/mock.rbs +9 -5
  301. data/stdlib/minitest/0/minitest/parallel/executor.rbs +4 -0
  302. data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +0 -1
  303. data/stdlib/minitest/0/minitest/pride_io.rbs +8 -0
  304. data/stdlib/minitest/0/minitest/pride_lol.rbs +2 -0
  305. data/stdlib/minitest/0/minitest/progress_reporter.rbs +1 -1
  306. data/stdlib/minitest/0/minitest/reportable.rbs +2 -0
  307. data/stdlib/minitest/0/minitest/runnable.rbs +33 -1
  308. data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +1 -1
  309. data/stdlib/minitest/0/minitest/spec/dsl.rbs +10 -6
  310. data/stdlib/minitest/0/minitest/spec.rbs +1 -1
  311. data/stdlib/minitest/0/minitest/statistics_reporter.rbs +5 -0
  312. data/stdlib/minitest/0/minitest/summary_reporter.rbs +0 -7
  313. data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +7 -7
  314. data/stdlib/minitest/0/minitest/test.rbs +7 -14
  315. data/stdlib/minitest/0/minitest/unexpected_error.rbs +2 -0
  316. data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
  317. data/stdlib/minitest/0/minitest/unit.rbs +1 -2
  318. data/stdlib/minitest/0/minitest.rbs +41 -892
  319. data/stdlib/monitor/0/monitor.rbs +91 -10
  320. data/stdlib/mutex_m/0/mutex_m.rbs +0 -2
  321. data/stdlib/net-http/0/manifest.yaml +1 -1
  322. data/stdlib/net-http/0/net-http.rbs +3858 -964
  323. data/stdlib/net-protocol/0/manifest.yaml +2 -0
  324. data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
  325. data/stdlib/net-smtp/0/manifest.yaml +2 -0
  326. data/stdlib/net-smtp/0/net-smtp.rbs +55 -0
  327. data/stdlib/nkf/0/nkf.rbs +35 -5
  328. data/stdlib/objspace/0/objspace.rbs +40 -18
  329. data/stdlib/observable/0/observable.rbs +217 -0
  330. data/stdlib/open-uri/0/manifest.yaml +4 -0
  331. data/stdlib/open-uri/0/open-uri.rbs +393 -0
  332. data/stdlib/open3/0/open3.rbs +147 -0
  333. data/stdlib/openssl/0/manifest.yaml +1 -0
  334. data/stdlib/openssl/0/openssl.rbs +681 -316
  335. data/stdlib/optparse/0/optparse.rbs +100 -65
  336. data/stdlib/pathname/0/pathname.rbs +24 -15
  337. data/stdlib/pp/0/manifest.yaml +2 -0
  338. data/stdlib/pp/0/pp.rbs +300 -0
  339. data/stdlib/prettyprint/0/prettyprint.rbs +2 -6
  340. data/stdlib/pstore/0/pstore.rbs +370 -156
  341. data/stdlib/psych/0/core_ext.rbs +12 -0
  342. data/stdlib/{yaml → psych}/0/dbm.rbs +3 -3
  343. data/stdlib/psych/0/manifest.yaml +3 -0
  344. data/stdlib/psych/0/psych.rbs +402 -0
  345. data/stdlib/{yaml → psych}/0/store.rbs +2 -2
  346. data/stdlib/pty/0/pty.rbs +63 -11
  347. data/stdlib/rdoc/0/code_object.rbs +51 -0
  348. data/stdlib/rdoc/0/comment.rbs +59 -0
  349. data/stdlib/rdoc/0/context.rbs +153 -0
  350. data/stdlib/rdoc/0/markup.rbs +117 -0
  351. data/stdlib/rdoc/0/parser.rbs +56 -0
  352. data/stdlib/rdoc/0/rdoc.rbs +13 -380
  353. data/stdlib/rdoc/0/ri.rbs +17 -0
  354. data/stdlib/rdoc/0/store.rbs +48 -0
  355. data/stdlib/rdoc/0/top_level.rbs +97 -0
  356. data/stdlib/resolv/0/resolv.rbs +16 -79
  357. data/stdlib/ripper/0/ripper.rbs +1648 -0
  358. data/stdlib/securerandom/0/securerandom.rbs +7 -2
  359. data/stdlib/shellwords/0/shellwords.rbs +11 -12
  360. data/stdlib/singleton/0/singleton.rbs +0 -3
  361. data/stdlib/socket/0/addrinfo.rbs +13 -18
  362. data/stdlib/socket/0/basic_socket.rbs +5 -10
  363. data/stdlib/socket/0/ip_socket.rbs +0 -2
  364. data/stdlib/socket/0/socket.rbs +77 -46
  365. data/stdlib/socket/0/tcp_server.rbs +0 -5
  366. data/stdlib/socket/0/tcp_socket.rbs +36 -3
  367. data/stdlib/socket/0/udp_socket.rbs +4 -5
  368. data/stdlib/socket/0/unix_server.rbs +0 -5
  369. data/stdlib/socket/0/unix_socket.rbs +2 -4
  370. data/{core/string_io.rbs → stdlib/stringio/0/stringio.rbs} +188 -107
  371. data/stdlib/strscan/0/string_scanner.rbs +1269 -425
  372. data/stdlib/tempfile/0/tempfile.rbs +224 -61
  373. data/stdlib/time/0/time.rbs +48 -35
  374. data/stdlib/timeout/0/timeout.rbs +17 -8
  375. data/stdlib/tmpdir/0/tmpdir.rbs +10 -3
  376. data/stdlib/tsort/0/tsort.rbs +0 -4
  377. data/stdlib/uri/0/common.rbs +271 -144
  378. data/stdlib/uri/0/file.rbs +5 -0
  379. data/stdlib/uri/0/ftp.rbs +1 -1
  380. data/stdlib/uri/0/generic.rbs +26 -22
  381. data/stdlib/uri/0/http.rbs +4 -4
  382. data/stdlib/uri/0/ldap.rbs +1 -1
  383. data/stdlib/uri/0/mailto.rbs +84 -0
  384. data/stdlib/uri/0/rfc2396_parser.rbs +3 -0
  385. data/stdlib/yaml/0/manifest.yaml +1 -2
  386. data/stdlib/yaml/0/yaml.rbs +1 -199
  387. data/stdlib/zlib/0/buf_error.rbs +10 -0
  388. data/stdlib/zlib/0/data_error.rbs +10 -0
  389. data/stdlib/zlib/0/deflate.rbs +210 -0
  390. data/stdlib/zlib/0/error.rbs +20 -0
  391. data/stdlib/zlib/0/gzip_file/crc_error.rbs +12 -0
  392. data/stdlib/zlib/0/gzip_file/error.rbs +23 -0
  393. data/stdlib/zlib/0/gzip_file/length_error.rbs +12 -0
  394. data/stdlib/zlib/0/gzip_file/no_footer.rbs +11 -0
  395. data/stdlib/zlib/0/gzip_file.rbs +156 -0
  396. data/stdlib/zlib/0/gzip_reader.rbs +293 -0
  397. data/stdlib/zlib/0/gzip_writer.rbs +166 -0
  398. data/stdlib/zlib/0/inflate.rbs +180 -0
  399. data/stdlib/zlib/0/mem_error.rbs +10 -0
  400. data/stdlib/zlib/0/need_dict.rbs +13 -0
  401. data/stdlib/zlib/0/stream_end.rbs +11 -0
  402. data/stdlib/zlib/0/stream_error.rbs +11 -0
  403. data/stdlib/zlib/0/version_error.rbs +11 -0
  404. data/stdlib/zlib/0/zlib.rbs +1 -3
  405. data/stdlib/zlib/0/zstream.rbs +200 -0
  406. data/templates/include/rbs/constants.h.erb +20 -0
  407. data/templates/include/rbs/ruby_objs.h.erb +10 -0
  408. data/templates/src/constants.c.erb +36 -0
  409. data/templates/src/ruby_objs.c.erb +27 -0
  410. data/templates/template.rb +122 -0
  411. metadata +136 -36
  412. data/Gemfile +0 -33
  413. data/Gemfile.lock +0 -118
  414. data/core/deprecated.rbs +0 -9
  415. data/ext/rbs_extension/constants.c +0 -135
  416. data/ext/rbs_extension/ruby_objs.c +0 -525
  417. data/ext/rbs_extension/ruby_objs.h +0 -43
  418. data/lib/rbs/constant_table.rb +0 -167
  419. data/lib/rbs/parser_compat/lexer_error.rb +0 -6
  420. data/lib/rbs/parser_compat/located_value.rb +0 -7
  421. data/lib/rbs/parser_compat/semantics_error.rb +0 -6
  422. data/lib/rbs/parser_compat/syntax_error.rb +0 -6
  423. data/lib/rbs/test/spy.rb +0 -6
  424. data/lib/rbs/type_name_resolver.rb +0 -67
  425. data/sig/constant_table.rbs +0 -30
  426. data/sig/shims/abstract_syntax_tree.rbs +0 -25
  427. data/sig/shims/pp.rbs +0 -3
  428. data/sig/shims/ripper.rbs +0 -8
  429. data/sig/shims.rbs +0 -69
  430. data/sig/type_name_resolver.rbs +0 -26
  431. data/stdlib/minitest/0/manifest.yaml +0 -2
  432. data/stdlib/prime/0/integer-extension.rbs +0 -41
  433. data/stdlib/prime/0/manifest.yaml +0 -2
  434. data/stdlib/prime/0/prime.rbs +0 -372
data/core/module.rbs CHANGED
@@ -85,13 +85,41 @@ class Module < Object
85
85
  #
86
86
  def self.used_modules: () -> ::Array[Module]
87
87
 
88
+ # <!--
89
+ # rdoc-file=eval.c
90
+ # - used_refinements -> array
91
+ # -->
92
+ # Returns an array of all modules used in the current scope. The ordering of
93
+ # modules in the resulting array is not defined.
94
+ #
95
+ # module A
96
+ # refine Object do
97
+ # end
98
+ # end
99
+ #
100
+ # module B
101
+ # refine Object do
102
+ # end
103
+ # end
104
+ #
105
+ # using A
106
+ # using B
107
+ # p Module.used_refinements
108
+ #
109
+ # *produces:*
110
+ #
111
+ # [#<refinement:Object@B>, #<refinement:Object@A>]
112
+ #
113
+ def self.used_refinements: () -> Array[Refinement]
114
+
88
115
  # <!--
89
116
  # rdoc-file=object.c
90
117
  # - mod < other -> true, false, or nil
91
118
  # -->
92
- # Returns true if *mod* is a subclass of *other*. Returns `nil` if there's no
93
- # relationship between the two. (Think of the relationship in terms of the class
94
- # definition: "class A < B" implies "A < B".)
119
+ # Returns true if *mod* is a subclass of *other*. Returns `false` if *mod* is
120
+ # the same as *other* or *mod* is an ancestor of *other*. Returns `nil` if
121
+ # there's no relationship between the two. (Think of the relationship in terms
122
+ # of the class definition: "class A < B" implies "A < B".)
95
123
  #
96
124
  def <: (Module other) -> bool?
97
125
 
@@ -169,9 +197,10 @@ class Module < Object
169
197
  # rdoc-file=object.c
170
198
  # - mod > other -> true, false, or nil
171
199
  # -->
172
- # Returns true if *mod* is an ancestor of *other*. Returns `nil` if there's no
173
- # relationship between the two. (Think of the relationship in terms of the class
174
- # definition: "class A < B" implies "B > A".)
200
+ # Returns true if *mod* is an ancestor of *other*. Returns `false` if *mod* is
201
+ # the same as *other* or *mod* is a descendant of *other*. Returns `nil` if
202
+ # there's no relationship between the two. (Think of the relationship in terms
203
+ # of the class definition: "class A < B" implies "B > A".)
175
204
  #
176
205
  def >: (Module other) -> bool?
177
206
 
@@ -206,7 +235,7 @@ class Module < Object
206
235
  #
207
236
  # Exiting with code 99
208
237
  #
209
- def alias_method: (::Symbol | ::String new_name, ::Symbol | ::String old_name) -> ::Symbol
238
+ def alias_method: (interned new_name, interned old_name) -> ::Symbol
210
239
 
211
240
  # <!--
212
241
  # rdoc-file=object.c
@@ -255,7 +284,7 @@ class Module < Object
255
284
  # end
256
285
  # Mod.instance_methods.sort #=> [:one, :one=, :two, :two=]
257
286
  #
258
- def attr_accessor: (*Symbol | String arg0) -> NilClass
287
+ def attr_accessor: (*interned arg0) -> Array[Symbol]
259
288
 
260
289
  # <!--
261
290
  # rdoc-file=object.c
@@ -269,7 +298,7 @@ class Module < Object
269
298
  # in turn. String arguments are converted to symbols. Returns an array of
270
299
  # defined method names as symbols.
271
300
  #
272
- def attr_reader: (*Symbol | String arg0) -> NilClass
301
+ def attr_reader: (*interned arg0) -> Array[Symbol]
273
302
 
274
303
  # <!--
275
304
  # rdoc-file=object.c
@@ -280,14 +309,14 @@ class Module < Object
280
309
  # *symbol*`.id2name`. String arguments are converted to symbols. Returns an
281
310
  # array of defined method names as symbols.
282
311
  #
283
- def attr_writer: (*Symbol | String arg0) -> NilClass
312
+ def attr_writer: (*interned arg0) -> Array[Symbol]
284
313
 
285
314
  # <!--
286
315
  # rdoc-file=load.c
287
- # - mod.autoload(module, filename) -> nil
316
+ # - mod.autoload(const, filename) -> nil
288
317
  # -->
289
318
  # Registers *filename* to be loaded (using Kernel::require) the first time that
290
- # *module* (which may be a String or a symbol) is accessed in the namespace of
319
+ # *const* (which may be a String or a symbol) is accessed in the namespace of
291
320
  # *mod*.
292
321
  #
293
322
  # module A
@@ -295,7 +324,11 @@ class Module < Object
295
324
  # A.autoload(:B, "b")
296
325
  # A::B.doit # autoloads "b"
297
326
  #
298
- def autoload: (Symbol _module, String filename) -> NilClass
327
+ # If *const* in *mod* is defined as autoload, the file name to be loaded is
328
+ # replaced with *filename*. If *const* is defined but not as autoload, does
329
+ # nothing.
330
+ #
331
+ def autoload: (interned _module, String filename) -> NilClass
299
332
 
300
333
  # <!--
301
334
  # rdoc-file=load.c
@@ -321,7 +354,7 @@ class Module < Object
321
354
  # B.autoload?(:CONST) #=> "const.rb", found in A (ancestor)
322
355
  # B.autoload?(:CONST, false) #=> nil, not found in B itself
323
356
  #
324
- def autoload?: (Symbol name, ?boolish inherit) -> String?
357
+ def autoload?: (interned name, ?boolish inherit) -> String?
325
358
 
326
359
  # <!-- rdoc-file=vm_eval.c -->
327
360
  # Evaluates the string or block in the context of *mod*, except that when a
@@ -344,7 +377,7 @@ class Module < Object
344
377
  # or method `code' for Thing:Class
345
378
  #
346
379
  def class_eval: (String arg0, ?String filename, ?Integer lineno) -> untyped
347
- | [U] () { (self m) -> U } -> U
380
+ | [U] () { (self m) [self: self] -> U } -> U
348
381
 
349
382
  # <!-- rdoc-file=vm_eval.c -->
350
383
  # Evaluates the given block in the context of the class/module. The method
@@ -363,7 +396,7 @@ class Module < Object
363
396
  #
364
397
  # Hello there!
365
398
  #
366
- def class_exec: [U] (*untyped args) { () -> U } -> U
399
+ def class_exec: [U] (*untyped, **untyped) { (?) [self: self] -> U } -> U
367
400
 
368
401
  # <!--
369
402
  # rdoc-file=object.c
@@ -379,7 +412,7 @@ class Module < Object
379
412
  # Fred.class_variable_defined?(:@@foo) #=> true
380
413
  # Fred.class_variable_defined?(:@@bar) #=> false
381
414
  #
382
- def class_variable_defined?: (Symbol | String arg0) -> bool
415
+ def class_variable_defined?: (interned arg0) -> bool
383
416
 
384
417
  # <!--
385
418
  # rdoc-file=object.c
@@ -395,7 +428,7 @@ class Module < Object
395
428
  # end
396
429
  # Fred.class_variable_get(:@@foo) #=> 99
397
430
  #
398
- def class_variable_get: (Symbol | String arg0) -> untyped
431
+ def class_variable_get: (interned arg0) -> untyped
399
432
 
400
433
  # <!--
401
434
  # rdoc-file=object.c
@@ -414,7 +447,7 @@ class Module < Object
414
447
  # Fred.class_variable_set(:@@foo, 101) #=> 101
415
448
  # Fred.new.foo #=> 101
416
449
  #
417
- def class_variable_set: (Symbol | String arg0, untyped arg1) -> untyped
450
+ def class_variable_set: (interned arg0, untyped arg1) -> untyped
418
451
 
419
452
  # <!--
420
453
  # rdoc-file=object.c
@@ -436,6 +469,26 @@ class Module < Object
436
469
  #
437
470
  def class_variables: (?boolish inherit) -> ::Array[Symbol]
438
471
 
472
+ # <!--
473
+ # rdoc-file=object.c
474
+ # - const_added(const_name)
475
+ # -->
476
+ # Invoked as a callback whenever a constant is assigned on the receiver
477
+ #
478
+ # module Chatty
479
+ # def self.const_added(const_name)
480
+ # super
481
+ # puts "Added #{const_name.inspect}"
482
+ # end
483
+ # FOO = 1
484
+ # end
485
+ #
486
+ # *produces:*
487
+ #
488
+ # Added :FOO
489
+ #
490
+ def const_added: (Symbol) -> void
491
+
439
492
  # <!--
440
493
  # rdoc-file=object.c
441
494
  # - mod.const_defined?(sym, inherit=true) -> true or false
@@ -474,7 +527,7 @@ class Module < Object
474
527
  #
475
528
  # Hash.const_defined? 'foobar' #=> NameError: wrong constant name foobar
476
529
  #
477
- def const_defined?: (Symbol | String name, ?boolish inherit) -> bool
530
+ def const_defined?: (interned name, ?boolish inherit) -> bool
478
531
 
479
532
  # <!--
480
533
  # rdoc-file=object.c
@@ -513,7 +566,7 @@ class Module < Object
513
566
  #
514
567
  # Object.const_get 'foobar' #=> NameError: wrong constant name foobar
515
568
  #
516
- def const_get: (Symbol | String name, ?boolish inherit) -> untyped
569
+ def const_get: (interned name, ?boolish inherit) -> untyped
517
570
 
518
571
  # <!--
519
572
  # rdoc-file=object.c
@@ -521,7 +574,7 @@ class Module < Object
521
574
  # -->
522
575
  # Invoked when a reference is made to an undefined constant in *mod*. It is
523
576
  # passed a symbol for the undefined constant, and returns a value to be used for
524
- # that constant. The following code is an example of the same:
577
+ # that constant. For example, consider:
525
578
  #
526
579
  # def Foo.const_missing(name)
527
580
  # name # return the constant name as Symbol
@@ -529,22 +582,27 @@ class Module < Object
529
582
  #
530
583
  # Foo::UNDEFINED_CONST #=> :UNDEFINED_CONST: symbol returned
531
584
  #
532
- # In the next example when a reference is made to an undefined constant, it
533
- # attempts to load a file whose name is the lowercase version of the constant
534
- # (thus class `Fred` is assumed to be in file `fred.rb`). If found, it returns
535
- # the loaded class. It therefore implements an autoload feature similar to
536
- # Kernel#autoload and Module#autoload.
585
+ # As the example above shows, `const_missing` is not required to create the
586
+ # missing constant in *mod*, though that is often a side-effect. The caller gets
587
+ # its return value when triggered. If the constant is also defined, further
588
+ # lookups won't hit `const_missing` and will return the value stored in the
589
+ # constant as usual. Otherwise, `const_missing` will be invoked again.
590
+ #
591
+ # In the next example, when a reference is made to an undefined constant,
592
+ # `const_missing` attempts to load a file whose path is the lowercase version of
593
+ # the constant name (thus class `Fred` is assumed to be in file `fred.rb`). If
594
+ # defined as a side-effect of loading the file, the method returns the value
595
+ # stored in the constant. This implements an autoload feature similar to
596
+ # Kernel#autoload and Module#autoload, though it differs in important ways.
537
597
  #
538
598
  # def Object.const_missing(name)
539
599
  # @looked_for ||= {}
540
600
  # str_name = name.to_s
541
- # raise "Class not found: #{name}" if @looked_for[str_name]
601
+ # raise "Constant not found: #{name}" if @looked_for[str_name]
542
602
  # @looked_for[str_name] = 1
543
603
  # file = str_name.downcase
544
604
  # require file
545
- # klass = const_get(name)
546
- # return klass if klass
547
- # raise "Class not found: #{name}"
605
+ # const_get(name, false)
548
606
  # end
549
607
  #
550
608
  def const_missing: (Symbol arg0) -> untyped
@@ -565,7 +623,7 @@ class Module < Object
565
623
  #
566
624
  # Object.const_set('foobar', 42) #=> NameError: wrong constant name foobar
567
625
  #
568
- def const_set: (Symbol | String arg0, untyped arg1) -> untyped
626
+ def const_set: (interned arg0, untyped arg1) -> untyped
569
627
 
570
628
  # <!--
571
629
  # rdoc-file=object.c
@@ -615,7 +673,7 @@ class Module < Object
615
673
  # p Object.const_source_location('A::C1') # => ["test.rb", 2] -- nesting is supported
616
674
  # p Object.const_source_location('String') # => [] -- constant is defined in C code
617
675
  #
618
- def const_source_location: (Symbol | String name, ?boolish inherit) -> ([ String, Integer ] | [ ] | nil)
676
+ def const_source_location: (interned name, ?boolish inherit) -> ([ String, Integer ] | [ ] | nil)
619
677
 
620
678
  # <!--
621
679
  # rdoc-file=object.c
@@ -673,8 +731,8 @@ class Module < Object
673
731
  # I'm Dino!
674
732
  # #<B:0x401b39e8>
675
733
  #
676
- def define_method: (Symbol | String arg0, ?Proc | Method | UnboundMethod arg1) -> Symbol
677
- | (Symbol | String arg0) { () -> untyped } -> Symbol
734
+ def define_method: (interned symbol, ^() [self: instance] -> untyped | Method | UnboundMethod method) -> Symbol
735
+ | (interned symbol) { () [self: instance] -> untyped } -> Symbol
678
736
 
679
737
  # <!--
680
738
  # rdoc-file=object.c
@@ -693,7 +751,7 @@ class Module < Object
693
751
  # HTTP::NOT_FOUND
694
752
  # # warning: constant HTTP::NOT_FOUND is deprecated
695
753
  #
696
- def deprecate_constant: (*Symbol) -> self
754
+ def deprecate_constant: (*interned) -> self
697
755
 
698
756
  def eql?: (untyped other) -> bool
699
757
 
@@ -761,7 +819,7 @@ class Module < Object
761
819
  # -->
762
820
  # Invokes Module.append_features on each parameter in reverse order.
763
821
  #
764
- def include: (*Module arg0) -> self
822
+ def include: (Module, *Module arg0) -> self
765
823
 
766
824
  # <!--
767
825
  # rdoc-file=object.c
@@ -851,7 +909,7 @@ class Module < Object
851
909
  # Assign the module to a constant (name starting uppercase) if you want to treat
852
910
  # it like a regular module.
853
911
  #
854
- def initialize: () -> Object
912
+ def initialize: () -> void
855
913
  | () { (Module arg0) -> untyped } -> void
856
914
 
857
915
  # <!--
@@ -883,7 +941,7 @@ class Module < Object
883
941
  #
884
942
  # Hello there, Dave!
885
943
  #
886
- def instance_method: (Symbol arg0) -> UnboundMethod
944
+ def instance_method: (interned arg0) -> UnboundMethod
887
945
 
888
946
  # <!--
889
947
  # rdoc-file=object.c
@@ -911,6 +969,15 @@ class Module < Object
911
969
  # C.instance_methods(false) #=> [:method3]
912
970
  # C.instance_methods.include?(:method2) #=> true
913
971
  #
972
+ # Note that method visibility changes in the current class, as well as aliases,
973
+ # are considered as methods of the current class by this method:
974
+ #
975
+ # class C < B
976
+ # alias method4 method2
977
+ # protected :method2
978
+ # end
979
+ # C.instance_methods(false).sort #=> [:method2, :method3, :method4]
980
+ #
914
981
  def instance_methods: (?boolish include_super) -> ::Array[Symbol]
915
982
 
916
983
  # <!--
@@ -967,7 +1034,7 @@ class Module < Object
967
1034
  # C.method_defined? "method4" #=> false
968
1035
  # C.method_defined? "private_method2" #=> false
969
1036
  #
970
- def method_defined?: (Symbol | String name, ?boolish inherit) -> bool
1037
+ def method_defined?: (interned name, ?boolish inherit) -> bool
971
1038
 
972
1039
  # <!--
973
1040
  # rdoc-file=object.c
@@ -1021,7 +1088,7 @@ class Module < Object
1021
1088
  # or method `code' for Thing:Class
1022
1089
  #
1023
1090
  def module_eval: (String arg0, ?String filename, ?Integer lineno) -> untyped
1024
- | [U] () { (self m) -> U } -> U
1091
+ | [U] () { (self m) [self: self] -> U } -> U
1025
1092
 
1026
1093
  # <!--
1027
1094
  # rdoc-file=vm_eval.c
@@ -1044,7 +1111,7 @@ class Module < Object
1044
1111
  #
1045
1112
  # Hello there!
1046
1113
  #
1047
- def module_exec: [U] (*untyped args) { (*untyped args) -> U } -> U
1114
+ def module_exec: [U] (*untyped, **untyped) { (?) [self: self] -> U } -> U
1048
1115
 
1049
1116
  # <!--
1050
1117
  # rdoc-file=vm_method.c
@@ -1085,13 +1152,17 @@ class Module < Object
1085
1152
  # Mod.one #=> "This is one"
1086
1153
  # c.call_one #=> "This is the new one"
1087
1154
  #
1088
- def module_function: (*Symbol | String arg0) -> self
1155
+ def module_function: () -> nil
1156
+ | (Symbol method_name) -> Symbol
1157
+ | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
1158
+ | (string method_name) -> string
1159
+ | (interned, interned, *interned method_name) -> Array[interned]
1089
1160
 
1090
1161
  # <!--
1091
1162
  # rdoc-file=object.c
1092
- # - mod.name -> string
1163
+ # - mod.name -> string or nil
1093
1164
  # -->
1094
- # Returns the name of the module *mod*. Returns nil for anonymous modules.
1165
+ # Returns the name of the module *mod*. Returns `nil` for anonymous modules.
1095
1166
  #
1096
1167
  def name: () -> String?
1097
1168
 
@@ -1101,7 +1172,7 @@ class Module < Object
1101
1172
  # -->
1102
1173
  # Invokes Module.prepend_features on each parameter in reverse order.
1103
1174
  #
1104
- def prepend: (*Module arg0) -> self
1175
+ def prepend: (Module, *Module arg0) -> self
1105
1176
 
1106
1177
  # <!--
1107
1178
  # rdoc-file=eval.c
@@ -1162,7 +1233,8 @@ class Module < Object
1162
1233
  | (Symbol method_name) -> Symbol
1163
1234
  | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
1164
1235
  | (string method_name) -> string
1165
- | (string | Symbol, string | Symbol, *string | Symbol method_name) -> Array[string | Symbol]
1236
+ | (interned, interned, *interned method_name) -> Array[interned]
1237
+ | (Array[interned]) -> Array[interned]
1166
1238
 
1167
1239
  # <!--
1168
1240
  # rdoc-file=vm_method.c
@@ -1184,7 +1256,8 @@ class Module < Object
1184
1256
  # end
1185
1257
  # end
1186
1258
  #
1187
- def private_class_method: (*Symbol | String arg0) -> self
1259
+ def private_class_method: (*interned arg0) -> self
1260
+ | (Array[interned] arg0) -> self
1188
1261
 
1189
1262
  # <!--
1190
1263
  # rdoc-file=object.c
@@ -1192,7 +1265,7 @@ class Module < Object
1192
1265
  # -->
1193
1266
  # Makes a list of existing constants private.
1194
1267
  #
1195
- def private_constant: (*Symbol arg0) -> self
1268
+ def private_constant: (*interned arg0) -> self
1196
1269
 
1197
1270
  # <!--
1198
1271
  # rdoc-file=object.c
@@ -1239,7 +1312,7 @@ class Module < Object
1239
1312
  # C.private_method_defined? "method2", false #=> false
1240
1313
  # C.method_defined? "method2" #=> false
1241
1314
  #
1242
- def private_method_defined?: (Symbol | String name, ?boolish inherit) -> bool
1315
+ def private_method_defined?: (interned name, ?boolish inherit) -> bool
1243
1316
 
1244
1317
  # <!--
1245
1318
  # rdoc-file=vm_method.c
@@ -1264,7 +1337,12 @@ class Module < Object
1264
1337
  #
1265
1338
  # To show a private method on RDoc, use `:doc:` instead of this.
1266
1339
  #
1267
- def protected: (*Symbol | String arg0) -> self
1340
+ def protected: () -> nil
1341
+ | (Symbol method_name) -> Symbol
1342
+ | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
1343
+ | (string method_name) -> string
1344
+ | (interned, interned, *interned method_name) -> Array[interned]
1345
+ | (Array[interned]) -> Array[interned]
1268
1346
 
1269
1347
  # <!--
1270
1348
  # rdoc-file=object.c
@@ -1303,7 +1381,7 @@ class Module < Object
1303
1381
  # C.protected_method_defined? "method2", false #=> false
1304
1382
  # C.method_defined? "method2" #=> true
1305
1383
  #
1306
- def protected_method_defined?: (Symbol | String name, ?boolish inherit) -> bool
1384
+ def protected_method_defined?: (interned name, ?boolish inherit) -> bool
1307
1385
 
1308
1386
  # <!--
1309
1387
  # rdoc-file=vm_method.c
@@ -1323,7 +1401,8 @@ class Module < Object
1323
1401
  | (Symbol method_name) -> Symbol
1324
1402
  | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
1325
1403
  | (string method_name) -> string
1326
- | (string | Symbol, string | Symbol, *string | Symbol method_name) -> Array[string | Symbol]
1404
+ | (interned, interned, *interned method_name) -> Array[interned]
1405
+ | (Array[interned]) -> Array[interned]
1327
1406
 
1328
1407
  # <!--
1329
1408
  # rdoc-file=vm_method.c
@@ -1336,7 +1415,8 @@ class Module < Object
1336
1415
  # String arguments are converted to symbols. An Array of Symbols and/or Strings
1337
1416
  # is also accepted.
1338
1417
  #
1339
- def public_class_method: (*Symbol | String arg0) -> self
1418
+ def public_class_method: (*interned arg0) -> self
1419
+ | (Array[interned] arg0) -> self
1340
1420
 
1341
1421
  # <!--
1342
1422
  # rdoc-file=object.c
@@ -1344,7 +1424,7 @@ class Module < Object
1344
1424
  # -->
1345
1425
  # Makes a list of existing constants public.
1346
1426
  #
1347
- def public_constant: (*Symbol arg0) -> self
1427
+ def public_constant: (*interned arg0) -> self
1348
1428
 
1349
1429
  # <!--
1350
1430
  # rdoc-file=proc.c
@@ -1352,7 +1432,7 @@ class Module < Object
1352
1432
  # -->
1353
1433
  # Similar to *instance_method*, searches public method only.
1354
1434
  #
1355
- def public_instance_method: (Symbol arg0) -> UnboundMethod
1435
+ def public_instance_method: (interned arg0) -> UnboundMethod
1356
1436
 
1357
1437
  # <!--
1358
1438
  # rdoc-file=object.c
@@ -1391,7 +1471,7 @@ class Module < Object
1391
1471
  # C.public_method_defined? "method2" #=> false
1392
1472
  # C.method_defined? "method2" #=> true
1393
1473
  #
1394
- def public_method_defined?: (Symbol | String name, ?boolish inherit) -> bool
1474
+ def public_method_defined?: (interned name, ?boolish inherit) -> bool
1395
1475
 
1396
1476
  # <!--
1397
1477
  # rdoc-file=eval.c
@@ -1401,7 +1481,29 @@ class Module < Object
1401
1481
  #
1402
1482
  # Returns a module, where refined methods are defined.
1403
1483
  #
1404
- def refine: (Module mod) { () -> void } -> Refinement
1484
+ def refine: (Module mod) { () [self: Refinement] -> void } -> Refinement
1485
+
1486
+ # <!--
1487
+ # rdoc-file=eval.c
1488
+ # - refinements -> array
1489
+ # -->
1490
+ # Returns an array of `Refinement` defined within the receiver.
1491
+ #
1492
+ # module A
1493
+ # refine Integer do
1494
+ # end
1495
+ #
1496
+ # refine String do
1497
+ # end
1498
+ # end
1499
+ #
1500
+ # p A.refinements
1501
+ #
1502
+ # *produces:*
1503
+ #
1504
+ # [#<refinement:Integer@A>, #<refinement:String@A>]
1505
+ #
1506
+ def refinements: () -> Array[Refinement]
1405
1507
 
1406
1508
  # <!--
1407
1509
  # rdoc-file=object.c
@@ -1421,7 +1523,7 @@ class Module < Object
1421
1523
  # 99
1422
1524
  # nil
1423
1525
  #
1424
- def remove_class_variable: (Symbol arg0) -> untyped
1526
+ def remove_class_variable: (interned arg0) -> untyped
1425
1527
 
1426
1528
  # <!--
1427
1529
  # rdoc-file=object.c
@@ -1431,7 +1533,7 @@ class Module < Object
1431
1533
  # previous value. If that constant referred to a module, this will not change
1432
1534
  # that module's name and can lead to confusion.
1433
1535
  #
1434
- def remove_const: (Symbol arg0) -> untyped
1536
+ def remove_const: (interned arg0) -> untyped
1435
1537
 
1436
1538
  # <!--
1437
1539
  # rdoc-file=vm_method.c
@@ -1441,7 +1543,56 @@ class Module < Object
1441
1543
  # Removes the method identified by *symbol* from the current class. For an
1442
1544
  # example, see Module#undef_method. String arguments are converted to symbols.
1443
1545
  #
1444
- def remove_method: (*Symbol | String arg0) -> self
1546
+ def remove_method: (*interned arg0) -> self
1547
+
1548
+ # <!--
1549
+ # rdoc-file=object.c
1550
+ # - mod.set_temporary_name(string) -> self
1551
+ # - mod.set_temporary_name(nil) -> self
1552
+ # -->
1553
+ # Sets the temporary name of the module. This name is reflected in introspection
1554
+ # of the module and the values that are related to it, such as instances,
1555
+ # constants, and methods.
1556
+ #
1557
+ # The name should be `nil` or a non-empty string that is not a valid constant
1558
+ # path (to avoid confusing between permanent and temporary names).
1559
+ #
1560
+ # The method can be useful to distinguish dynamically generated classes and
1561
+ # modules without assigning them to constants.
1562
+ #
1563
+ # If the module is given a permanent name by assigning it to a constant, the
1564
+ # temporary name is discarded. A temporary name can't be assigned to modules
1565
+ # that have a permanent name.
1566
+ #
1567
+ # If the given name is `nil`, the module becomes anonymous again.
1568
+ #
1569
+ # Example:
1570
+ #
1571
+ # m = Module.new # => #<Module:0x0000000102c68f38>
1572
+ # m.name #=> nil
1573
+ #
1574
+ # m.set_temporary_name("fake_name") # => fake_name
1575
+ # m.name #=> "fake_name"
1576
+ #
1577
+ # m.set_temporary_name(nil) # => #<Module:0x0000000102c68f38>
1578
+ # m.name #=> nil
1579
+ #
1580
+ # c = Class.new
1581
+ # c.set_temporary_name("MyClass(with description)")
1582
+ #
1583
+ # c.new # => #<MyClass(with description):0x0....>
1584
+ #
1585
+ # c::M = m
1586
+ # c::M.name #=> "MyClass(with description)::M"
1587
+ #
1588
+ # # Assigning to a constant replaces the name with a permanent one
1589
+ # C = c
1590
+ #
1591
+ # C.name #=> "C"
1592
+ # C::M.name #=> "C::M"
1593
+ # c.new # => #<C:0x0....>
1594
+ #
1595
+ def set_temporary_name: (string?) -> self
1445
1596
 
1446
1597
  # <!--
1447
1598
  # rdoc-file=object.c
@@ -1505,9 +1656,18 @@ class Module < Object
1505
1656
  #
1506
1657
  # In child
1507
1658
  # In parent
1508
- # prog.rb:23: undefined method `hello' for #<Child:0x401b3bb4> (NoMethodError)
1659
+ # prog.rb:23: undefined method 'hello' for #<Child:0x401b3bb4> (NoMethodError)
1660
+ #
1661
+ def undef_method: (*interned arg0) -> self
1662
+
1663
+ # <!--
1664
+ # rdoc-file=object.c
1665
+ # - mod.undefined_instance_methods -> array
1666
+ # -->
1667
+ # Returns a list of the undefined instance methods defined in *mod*. The
1668
+ # undefined methods of any ancestors are not included.
1509
1669
  #
1510
- def undef_method: (*Symbol | String arg0) -> self
1670
+ def undefined_instance_methods: () -> Array[Symbol]
1511
1671
 
1512
1672
  # <!--
1513
1673
  # rdoc-file=eval.c
@@ -1536,5 +1696,9 @@ class Module < Object
1536
1696
  # `attr_reader(name)` but deprecated. Returns an array of defined method names
1537
1697
  # as symbols.
1538
1698
  #
1539
- def attr: (*Symbol | String arg0) -> NilClass
1699
+ def attr: (*interned arg0) -> Array[Symbol]
1700
+
1701
+ # A previous incarnation of `interned` for backward-compatibility (see #1499)
1702
+ %a{steep:deprecated}
1703
+ type id = interned
1540
1704
  end