rbs 3.6.1 → 3.9.5

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 (268) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +2 -2
  3. data/.github/workflows/dependabot.yml +1 -1
  4. data/.github/workflows/ruby.yml +34 -10
  5. data/.github/workflows/windows.yml +20 -3
  6. data/.gitignore +1 -0
  7. data/.rubocop.yml +26 -1
  8. data/CHANGELOG.md +241 -0
  9. data/Rakefile +54 -4
  10. data/config.yml +317 -0
  11. data/core/array.rbs +1756 -1591
  12. data/core/basic_object.rbs +38 -35
  13. data/core/comparable.rbs +1 -1
  14. data/core/complex.rbs +166 -94
  15. data/core/data.rbs +2 -2
  16. data/core/dir.rbs +2 -18
  17. data/core/encoding.rbs +12 -32
  18. data/core/enumerable.rbs +270 -266
  19. data/core/enumerator.rbs +14 -4
  20. data/core/env.rbs +1 -1
  21. data/core/errno.rbs +33 -16
  22. data/core/errors.rbs +6 -2
  23. data/core/exception.rbs +342 -167
  24. data/core/fiber.rbs +3 -2
  25. data/core/file.rbs +26 -75
  26. data/core/float.rbs +125 -72
  27. data/core/gc.rbs +158 -42
  28. data/core/hash.rbs +122 -143
  29. data/core/integer.rbs +79 -50
  30. data/core/io/buffer.rbs +49 -43
  31. data/core/io.rbs +108 -151
  32. data/core/kernel.rbs +341 -209
  33. data/core/match_data.rbs +76 -2
  34. data/core/math.rbs +0 -36
  35. data/core/method.rbs +2 -2
  36. data/core/module.rbs +32 -27
  37. data/core/nil_class.rbs +2 -2
  38. data/core/numeric.rbs +101 -104
  39. data/core/object.rbs +1 -5
  40. data/core/object_space/weak_key_map.rbs +3 -4
  41. data/core/object_space.rbs +3 -3
  42. data/core/proc.rbs +82 -14
  43. data/core/process.rbs +110 -58
  44. data/core/ractor.rbs +57 -4
  45. data/core/range.rbs +114 -87
  46. data/core/rational.rbs +0 -2
  47. data/core/rbs/unnamed/argf.rbs +237 -36
  48. data/core/rbs/unnamed/env_class.rbs +35 -53
  49. data/core/rbs/unnamed/random.rbs +1 -2
  50. data/core/regexp.rbs +10 -56
  51. data/core/ruby_vm.rbs +88 -9
  52. data/core/rubygems/config_file.rbs +3 -0
  53. data/core/rubygems/errors.rbs +3 -6
  54. data/core/rubygems/platform.rbs +0 -9
  55. data/core/rubygems/rubygems.rbs +3 -6
  56. data/core/rubygems/version.rbs +8 -8
  57. data/core/set.rbs +4 -16
  58. data/core/string.rbs +271 -264
  59. data/core/struct.rbs +6 -18
  60. data/core/symbol.rbs +14 -21
  61. data/core/thread.rbs +32 -35
  62. data/core/time.rbs +131 -50
  63. data/core/trace_point.rbs +124 -113
  64. data/core/true_class.rbs +0 -1
  65. data/core/unbound_method.rbs +1 -1
  66. data/core/warning.rbs +9 -2
  67. data/docs/architecture.md +1 -1
  68. data/docs/syntax.md +17 -10
  69. data/ext/rbs_extension/extconf.rb +11 -0
  70. data/ext/rbs_extension/location.c +61 -29
  71. data/ext/rbs_extension/location.h +4 -3
  72. data/ext/rbs_extension/main.c +23 -1
  73. data/ext/rbs_extension/parser.c +506 -517
  74. data/ext/rbs_extension/parserstate.c +109 -30
  75. data/ext/rbs_extension/parserstate.h +6 -4
  76. data/ext/rbs_extension/rbs_extension.h +1 -10
  77. data/{ext/rbs_extension → include/rbs}/constants.h +21 -19
  78. data/include/rbs/ruby_objs.h +72 -0
  79. data/include/rbs/util/rbs_constant_pool.h +219 -0
  80. data/include/rbs.h +7 -0
  81. data/lib/rbs/annotate/annotations.rb +3 -3
  82. data/lib/rbs/annotate/rdoc_source.rb +2 -2
  83. data/lib/rbs/ast/declarations.rb +9 -4
  84. data/lib/rbs/ast/directives.rb +10 -0
  85. data/lib/rbs/ast/members.rb +2 -0
  86. data/lib/rbs/ast/type_param.rb +2 -12
  87. data/lib/rbs/cli/diff.rb +3 -3
  88. data/lib/rbs/cli/validate.rb +2 -1
  89. data/lib/rbs/cli.rb +16 -16
  90. data/lib/rbs/collection/config/lockfile_generator.rb +58 -8
  91. data/lib/rbs/collection/config.rb +5 -3
  92. data/lib/rbs/collection/sources/rubygems.rb +1 -1
  93. data/lib/rbs/collection.rb +1 -0
  94. data/lib/rbs/definition.rb +51 -34
  95. data/lib/rbs/definition_builder/ancestor_builder.rb +5 -3
  96. data/lib/rbs/definition_builder.rb +83 -24
  97. data/lib/rbs/environment.rb +33 -18
  98. data/lib/rbs/environment_loader.rb +6 -1
  99. data/lib/rbs/errors.rb +24 -0
  100. data/lib/rbs/locator.rb +2 -0
  101. data/lib/rbs/method_type.rb +2 -0
  102. data/lib/rbs/namespace.rb +1 -0
  103. data/lib/rbs/parser_aux.rb +40 -3
  104. data/lib/rbs/prototype/rb.rb +20 -12
  105. data/lib/rbs/prototype/rbi.rb +11 -6
  106. data/lib/rbs/prototype/runtime/value_object_generator.rb +7 -5
  107. data/lib/rbs/prototype/runtime.rb +7 -5
  108. data/lib/rbs/subtractor.rb +3 -3
  109. data/lib/rbs/test/hook.rb +47 -42
  110. data/lib/rbs/test/type_check.rb +7 -5
  111. data/lib/rbs/type_name.rb +14 -9
  112. data/lib/rbs/types.rb +63 -14
  113. data/lib/rbs/unit_test/spy.rb +4 -2
  114. data/lib/rbs/unit_test/type_assertions.rb +19 -13
  115. data/lib/rbs/unit_test/with_aliases.rb +3 -1
  116. data/lib/rbs/validator.rb +7 -1
  117. data/lib/rbs/version.rb +1 -1
  118. data/lib/rbs/writer.rb +10 -5
  119. data/lib/rbs.rb +1 -0
  120. data/lib/rdoc_plugin/parser.rb +2 -2
  121. data/rbs.gemspec +6 -2
  122. data/sig/ancestor_graph.rbs +5 -5
  123. data/sig/annotate/rdoc_source.rbs +2 -0
  124. data/sig/cli.rbs +2 -0
  125. data/sig/collection/config/lockfile_generator.rbs +9 -1
  126. data/sig/declarations.rbs +10 -3
  127. data/sig/definition.rbs +80 -12
  128. data/sig/definition_builder.rbs +18 -4
  129. data/sig/directives.rbs +17 -1
  130. data/sig/environment.rbs +3 -1
  131. data/sig/errors.rbs +19 -0
  132. data/sig/namespace.rbs +2 -3
  133. data/sig/parser.rbs +5 -1
  134. data/sig/prototype/rb.rbs +1 -1
  135. data/sig/resolver/constant_resolver.rbs +2 -2
  136. data/sig/resolver/context.rbs +1 -1
  137. data/sig/subtractor.rbs +1 -1
  138. data/sig/test/type_check.rbs +2 -2
  139. data/sig/type_alias_dependency.rbs +2 -2
  140. data/sig/type_alias_regularity.rbs +6 -6
  141. data/sig/type_param.rbs +4 -4
  142. data/sig/typename.rbs +8 -5
  143. data/sig/types.rbs +1 -1
  144. data/sig/unit_test/spy.rbs +2 -0
  145. data/sig/unit_test/type_assertions.rbs +2 -0
  146. data/sig/use_map.rbs +1 -1
  147. data/sig/validator.rbs +6 -2
  148. data/sig/vendorer.rbs +1 -1
  149. data/sig/writer.rbs +1 -1
  150. data/{ext/rbs_extension → src}/constants.c +35 -36
  151. data/src/ruby_objs.c +799 -0
  152. data/src/util/rbs_constant_pool.c +342 -0
  153. data/stdlib/base64/0/base64.rbs +0 -9
  154. data/stdlib/benchmark/0/benchmark.rbs +11 -2
  155. data/stdlib/bigdecimal/0/big_decimal.rbs +26 -182
  156. data/stdlib/cgi/0/core.rbs +60 -3
  157. data/stdlib/cgi/0/manifest.yaml +1 -0
  158. data/stdlib/coverage/0/coverage.rbs +0 -3
  159. data/stdlib/csv/0/csv.rbs +18 -58
  160. data/stdlib/csv/0/manifest.yaml +1 -0
  161. data/stdlib/date/0/date.rbs +27 -42
  162. data/stdlib/did_you_mean/0/did_you_mean.rbs +1 -6
  163. data/stdlib/digest/0/digest.rbs +25 -2
  164. data/stdlib/erb/0/erb.rbs +0 -1
  165. data/stdlib/etc/0/etc.rbs +51 -34
  166. data/stdlib/fileutils/0/fileutils.rbs +3 -44
  167. data/stdlib/io-console/0/io-console.rbs +69 -15
  168. data/stdlib/ipaddr/0/ipaddr.rbs +16 -4
  169. data/stdlib/json/0/json.rbs +107 -120
  170. data/stdlib/logger/0/log_device.rbs +1 -1
  171. data/stdlib/logger/0/logger.rbs +3 -18
  172. data/stdlib/minitest/0/kernel.rbs +2 -2
  173. data/stdlib/minitest/0/minitest/abstract_reporter.rbs +4 -1
  174. data/stdlib/minitest/0/minitest/assertion.rbs +1 -0
  175. data/stdlib/minitest/0/minitest/assertions.rbs +58 -13
  176. data/stdlib/minitest/0/minitest/backtrace_filter.rbs +7 -0
  177. data/stdlib/minitest/0/minitest/bench_spec.rbs +8 -8
  178. data/stdlib/minitest/0/minitest/benchmark.rbs +17 -16
  179. data/stdlib/minitest/0/minitest/compress.rbs +13 -0
  180. data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
  181. data/stdlib/minitest/0/minitest/mock.rbs +9 -5
  182. data/stdlib/minitest/0/minitest/parallel/executor.rbs +4 -0
  183. data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +0 -1
  184. data/stdlib/minitest/0/minitest/pride_io.rbs +8 -0
  185. data/stdlib/minitest/0/minitest/pride_lol.rbs +2 -0
  186. data/stdlib/minitest/0/minitest/progress_reporter.rbs +1 -1
  187. data/stdlib/minitest/0/minitest/reportable.rbs +2 -0
  188. data/stdlib/minitest/0/minitest/runnable.rbs +33 -1
  189. data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +1 -1
  190. data/stdlib/minitest/0/minitest/spec/dsl.rbs +10 -6
  191. data/stdlib/minitest/0/minitest/spec.rbs +1 -1
  192. data/stdlib/minitest/0/minitest/statistics_reporter.rbs +5 -0
  193. data/stdlib/minitest/0/minitest/summary_reporter.rbs +0 -7
  194. data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +1 -1
  195. data/stdlib/minitest/0/minitest/test.rbs +7 -14
  196. data/stdlib/minitest/0/minitest/unexpected_error.rbs +2 -0
  197. data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
  198. data/stdlib/minitest/0/minitest/unit.rbs +1 -2
  199. data/stdlib/minitest/0/minitest.rbs +41 -892
  200. data/stdlib/monitor/0/monitor.rbs +13 -4
  201. data/stdlib/net-http/0/net-http.rbs +42 -109
  202. data/stdlib/nkf/0/nkf.rbs +30 -0
  203. data/stdlib/objspace/0/objspace.rbs +1 -2
  204. data/stdlib/observable/0/observable.rbs +1 -1
  205. data/stdlib/open-uri/0/manifest.yaml +1 -0
  206. data/stdlib/open-uri/0/open-uri.rbs +52 -0
  207. data/stdlib/open3/0/open3.rbs +0 -8
  208. data/stdlib/openssl/0/manifest.yaml +1 -0
  209. data/stdlib/openssl/0/openssl.rbs +235 -143
  210. data/stdlib/optparse/0/optparse.rbs +58 -18
  211. data/stdlib/pathname/0/pathname.rbs +2 -8
  212. data/stdlib/pp/0/pp.rbs +3 -1
  213. data/stdlib/prettyprint/0/prettyprint.rbs +0 -4
  214. data/stdlib/pstore/0/pstore.rbs +0 -6
  215. data/stdlib/psych/0/core_ext.rbs +12 -0
  216. data/stdlib/psych/0/psych.rbs +15 -4
  217. data/stdlib/pty/0/pty.rbs +46 -4
  218. data/stdlib/rdoc/0/code_object.rbs +0 -4
  219. data/stdlib/rdoc/0/markup.rbs +10 -12
  220. data/stdlib/rdoc/0/rdoc.rbs +13 -8
  221. data/stdlib/resolv/0/resolv.rbs +21 -12
  222. data/stdlib/ripper/0/ripper.rbs +0 -2
  223. data/stdlib/securerandom/0/securerandom.rbs +7 -2
  224. data/stdlib/shellwords/0/shellwords.rbs +11 -12
  225. data/stdlib/singleton/0/singleton.rbs +0 -1
  226. data/stdlib/socket/0/addrinfo.rbs +1 -2
  227. data/stdlib/socket/0/basic_socket.rbs +0 -5
  228. data/stdlib/socket/0/socket.rbs +32 -27
  229. data/stdlib/socket/0/tcp_server.rbs +0 -3
  230. data/stdlib/socket/0/tcp_socket.rbs +36 -3
  231. data/stdlib/socket/0/udp_socket.rbs +0 -1
  232. data/stdlib/socket/0/unix_server.rbs +0 -3
  233. data/stdlib/socket/0/unix_socket.rbs +4 -2
  234. data/{core/string_io.rbs → stdlib/stringio/0/stringio.rbs} +1 -1
  235. data/stdlib/strscan/0/string_scanner.rbs +1265 -422
  236. data/stdlib/tempfile/0/tempfile.rbs +135 -28
  237. data/stdlib/time/0/time.rbs +48 -35
  238. data/stdlib/timeout/0/timeout.rbs +11 -8
  239. data/stdlib/tmpdir/0/tmpdir.rbs +10 -3
  240. data/stdlib/tsort/0/tsort.rbs +0 -4
  241. data/stdlib/uri/0/common.rbs +28 -30
  242. data/stdlib/uri/0/ftp.rbs +1 -1
  243. data/stdlib/uri/0/generic.rbs +22 -18
  244. data/stdlib/uri/0/http.rbs +2 -2
  245. data/stdlib/uri/0/rfc2396_parser.rbs +3 -0
  246. data/stdlib/zlib/0/buf_error.rbs +1 -70
  247. data/stdlib/zlib/0/data_error.rbs +1 -70
  248. data/stdlib/zlib/0/deflate.rbs +8 -72
  249. data/stdlib/zlib/0/error.rbs +1 -70
  250. data/stdlib/zlib/0/gzip_file/crc_error.rbs +2 -105
  251. data/stdlib/zlib/0/gzip_file/error.rbs +2 -105
  252. data/stdlib/zlib/0/gzip_file/length_error.rbs +2 -105
  253. data/stdlib/zlib/0/gzip_file/no_footer.rbs +2 -105
  254. data/stdlib/zlib/0/gzip_file.rbs +1 -71
  255. data/stdlib/zlib/0/gzip_reader.rbs +3 -74
  256. data/stdlib/zlib/0/gzip_writer.rbs +1 -70
  257. data/stdlib/zlib/0/inflate.rbs +4 -71
  258. data/stdlib/zlib/0/mem_error.rbs +1 -70
  259. data/stdlib/zlib/0/need_dict.rbs +1 -70
  260. data/stdlib/zlib/0/stream_end.rbs +1 -70
  261. data/stdlib/zlib/0/stream_error.rbs +1 -70
  262. data/stdlib/zlib/0/version_error.rbs +1 -70
  263. data/stdlib/zlib/0/zlib.rbs +0 -2
  264. data/stdlib/zlib/0/zstream.rbs +4 -72
  265. metadata +17 -13
  266. data/ext/rbs_extension/ruby_objs.c +0 -602
  267. data/ext/rbs_extension/ruby_objs.h +0 -51
  268. data/stdlib/minitest/0/manifest.yaml +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd93b9bdce0e6148409689ba4aa2db4d34109e46b799706b6f44944134f1b817
4
- data.tar.gz: 3780dcddba54316cf7cb97224f7dc7a187195904a3f21cc430a017c03d663387
3
+ metadata.gz: 0d490d8913cfa35f6554fce9b6d23e441b2b5dc41da82ff94551d86cc4a95bfd
4
+ data.tar.gz: a352b325e582ccc60629f968dd29fba39ff2e0ffcbe0b2208711433dbfc4e4a5
5
5
  SHA512:
6
- metadata.gz: 786d469a57422f169e2980a4b0f80eb4ec857081f51b2c56ac87e070abd118b4245f537457de06058ef32ea394742e9bcb3cd106c7d3408b51a0aab8a622a260
7
- data.tar.gz: 7b70ac096f7d53171b5aebcafc6605426e80ee598cddabb70c520b689cc07fadbaa22bda3d2bd9f6a748587cc6ce11246c3a79f50125ea102cf561ed66bfc353
6
+ metadata.gz: e12fd282d0c28d5eaa981694a51b32b021033f2acae8ca63e84872f6f4737ccf2846df04f5d057225f8a06b260486bf6fabd6558ccdd502c84e3a622efb235e5
7
+ data.tar.gz: c043af2b405b3942450a18d92140bafddbca5449b8ab36c02c3fad5d25556d7408f71e2b304ae67e5610856a0ddd9e13ea79d3034087c0c3af3f9ca2dfa80b01
@@ -11,12 +11,12 @@ jobs:
11
11
  comments:
12
12
  runs-on: "ubuntu-latest"
13
13
  # env:
14
- # RUBY_COMMIT: v3_3_0
14
+ # RUBY_COMMIT: 1b0c46daed9186b82ab4fef1a4ab225afe582ee6
15
15
  steps:
16
16
  - uses: actions/checkout@v4
17
17
  - uses: ruby/setup-ruby@v1
18
18
  with:
19
- ruby-version: "3.3"
19
+ ruby-version: "3.4.1"
20
20
  bundler: none
21
21
  - name: Install dependencies
22
22
  run: |
@@ -14,7 +14,7 @@ jobs:
14
14
  if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
15
15
  steps:
16
16
  - name: Dependabot metadata
17
- uses: dependabot/fetch-metadata@dbb049abf0d677abbd7f7eee0375145b417fdd34 # v2.2.0
17
+ uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7 # v2.3.0
18
18
  id: metadata
19
19
  - name: Checkout repository
20
20
  uses: actions/checkout@v4
@@ -13,27 +13,29 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby: ['3.0', '3.1', '3.2', '3.3', head]
16
+ ruby: ['3.1', '3.2', '3.3', '3.4', head]
17
17
  rubyopt: [""]
18
18
  job:
19
19
  - test
20
20
  include:
21
21
  - ruby: head
22
22
  job: stdlib_test rubocop
23
- - ruby: "3.3"
23
+ - ruby: "3.4"
24
24
  job: stdlib_test
25
- - ruby: "3.3"
25
+ - ruby: "3.4"
26
26
  job: test
27
27
  rubyopt: "--enable-frozen-string-literal"
28
- - ruby: "3.3"
28
+ - ruby: "3.4"
29
29
  job: stdlib_test
30
30
  rubyopt: "--enable-frozen-string-literal"
31
- - ruby: "3.3"
32
- job: lexer compile confirm_lexer
33
- - ruby: "3.3"
31
+ - ruby: "3.4"
32
+ job: lexer templates compile confirm_lexer confirm_templates
33
+ - ruby: "3.4"
34
34
  job: rubocop validate test_doc build test_generate_stdlib raap
35
- - ruby: "3.3"
35
+ - ruby: "3.4"
36
36
  job: typecheck_test
37
+ env:
38
+ RANDOMIZE_STDLIB_TEST_ORDER: "true"
37
39
  steps:
38
40
  - uses: actions/checkout@v4
39
41
  - uses: ruby/setup-ruby@v1
@@ -42,8 +44,6 @@ jobs:
42
44
  bundler: none
43
45
  - name: Set working directory as safe
44
46
  run: git config --global --add safe.directory $(pwd)
45
- - name: Set up permission
46
- run: chmod -R o-w /opt/hostedtoolcache/Ruby
47
47
  - name: Install dependencies
48
48
  run: |
49
49
  sudo apt-get update
@@ -78,3 +78,27 @@ jobs:
78
78
  - name: Run test
79
79
  run: |
80
80
  bundle exec rake ${{ matrix.job }}
81
+ valgrind:
82
+ runs-on: ubuntu-latest
83
+ steps:
84
+ - uses: actions/checkout@v2
85
+ - uses: ruby/setup-ruby@v1
86
+ with:
87
+ ruby-version: "3.4"
88
+ bundler-cache: none
89
+ - name: Set working directory as safe
90
+ run: git config --global --add safe.directory $(pwd)
91
+ - name: Install dependencies
92
+ run: |
93
+ sudo apt-get update
94
+ sudo apt-get install -y libdb-dev curl autoconf automake m4 libtool python3 valgrind
95
+ - name: Update rubygems & bundler
96
+ run: |
97
+ ruby -v
98
+ gem update --system
99
+ - name: bin/setup
100
+ run: |
101
+ bin/setup
102
+ - run: bundle exec rake test:valgrind
103
+ env:
104
+ RUBY_FREE_AT_EXIT: 1
@@ -20,7 +20,24 @@ jobs:
20
20
  uses: ruby/setup-ruby@v1
21
21
  with:
22
22
  ruby-version: ${{ matrix.ruby }}
23
- - name: rake-compiler
24
- run: gem install rake-compiler
23
+
24
+ # ucrt and mswin have the dev version Ruby.
25
+ # It introduce checksum mismatches for bundled gems. So remove them before `bundle install`
26
+ - name: Purge gem caches
27
+ run: |
28
+ ruby -e '
29
+ exit if "${{ matrix.ruby }}" != "ucrt" && "${{ matrix.ruby }}" != "mswin"
30
+
31
+ require "open-uri"
32
+ require "json"
33
+
34
+ res = URI.parse("https://stdgems.org/bundled_gems.json").read
35
+ bundled_gems = JSON.parse(res)["gems"].map{_1["gem"]}
36
+ system "gem uninstall --force #{bundled_gems.join(" ")}", exception: true
37
+ '
38
+ - name: bundle install
39
+ run: |
40
+ bundle config set without profilers libs
41
+ bundle install
25
42
  - name: compile
26
- run: rake compile
43
+ run: bundle exec rake compile
data/.gitignore CHANGED
@@ -19,4 +19,5 @@ lib/**/*.bundle
19
19
  lib/**/*.so
20
20
  lib/**/*.dll
21
21
  doc/
22
+
22
23
  **/*.gem
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ require:
3
3
  - rubocop-on-rbs
4
4
 
5
5
  AllCops:
6
- TargetRubyVersion: 3.0
6
+ TargetRubyVersion: 3.1
7
7
  DisabledByDefault: true
8
8
  Exclude:
9
9
  - 'vendor/bundle/**/*'
@@ -15,6 +15,7 @@ Rubycw/Rubycw:
15
15
 
16
16
  RBS:
17
17
  Enabled: true
18
+
18
19
  RBS/Layout:
19
20
  Enabled: true
20
21
  Exclude:
@@ -23,18 +24,42 @@ RBS/Layout:
23
24
  RBS/Layout/CommentIndentation:
24
25
  Exclude:
25
26
  - core/string.rbs
27
+
26
28
  RBS/Lint:
27
29
  Enabled: true
28
30
  Exclude:
29
31
  - 'sig/**/*'
30
32
  - 'test/**/*'
33
+ RBS/Lint/TopLevelInterface:
34
+ Enabled: false
35
+ RBS/Lint/TopLevelTypeAlias:
36
+ Enabled: false
37
+ RBS/Lint/AmbiguousKeywordArgumentKey:
38
+ Exclude:
39
+ # OpenSSL::KDF.scrypt
40
+ - 'stdlib/openssl/0/openssl.rbs'
41
+
31
42
  RBS/Style:
32
43
  Enabled: false
33
44
  Exclude:
34
45
  - 'sig/**/*'
35
46
  - 'test/**/*'
47
+ RBS/Style/BlockReturnBoolish:
48
+ Enabled: true
49
+ RBS/Style/ClassWithSingleton:
50
+ Enabled: true
51
+ RBS/Style/DuplicatedType:
52
+ Enabled: true
53
+ RBS/Style/EmptyArgument:
54
+ Enabled: true
36
55
  RBS/Style/InitializeReturnType:
37
56
  Enabled: true
57
+ RBS/Style/InstanceWithInstance:
58
+ Enabled: true
59
+ RBS/Style/OptionalNil:
60
+ Enabled: true
61
+ RBS/Style/RedundantParentheses:
62
+ Enabled: true
38
63
 
39
64
  Lint/DuplicateMethods:
40
65
  Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,246 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.9.5 (2025-09-08)
4
+
5
+ ### Signature updates
6
+
7
+ * Merge pull request #2655 from ruby/silence-string-deprecation ([#2656](https://github.com/ruby/rbs/pull/2656))
8
+
9
+ ### Miscellaneous
10
+
11
+ * Allows the use of a path list as RBS_SKIP_TESTS ([#2641](https://github.com/ruby/rbs/pull/2641))
12
+ * Suppress to GCC warning with multi-line comment ([#2646](https://github.com/ruby/rbs/pull/2646))
13
+ * Backport to 3.9 ([#2487](https://github.com/ruby/rbs/pull/2487))
14
+ * Use erb instead of set for load path testing ([#2468](https://github.com/ruby/rbs/pull/2468))
15
+
16
+ ## 3.9.4 (2025-05-15)
17
+
18
+ ### Miscellaneous
19
+
20
+ * Backport test/CI fixes to 3.9 ([#2487](https://github.com/ruby/rbs/pull/2487))
21
+ * Use erb instead of set for load path testing ([#2468](https://github.com/ruby/rbs/pull/2468))
22
+
23
+ ## 3.9.3 (2025-05-09)
24
+
25
+ ### Miscellaneous
26
+
27
+ * Use erb instead of set for load path testing ([#2468](https://github.com/ruby/rbs/pull/2468))
28
+
29
+ ## 3.9.2 (2025-03-31)
30
+
31
+ ### Library changes
32
+
33
+ * Change `{}` to `{ 0 }` ([#2354](https://github.com/ruby/rbs/pull/2354))
34
+
35
+ ## 3.9.1 (2025-03-24)
36
+
37
+ ### Miscellaneous
38
+
39
+ * `did_you_mean` is a default gem ([#2348](https://github.com/ruby/rbs/pull/2348))
40
+ * Skip loading ruby_memcheck ([#2347](https://github.com/ruby/rbs/pull/2347))
41
+
42
+ ## 3.9.0 (2025-03-18)
43
+
44
+ ### Miscellaneous
45
+
46
+ * Update steep ([#2328](https://github.com/ruby/rbs/pull/2328))
47
+
48
+ ## 3.9.0.pre.2 (2025-03-14)
49
+
50
+ ### Signature updates
51
+
52
+ * `Hash.new` type ([#2323](https://github.com/ruby/rbs/pull/2323))
53
+ * `Module#define_method` ([#2325](https://github.com/ruby/rbs/pull/2325))
54
+ * `Object#define_singleton_method` ([#2324](https://github.com/ruby/rbs/pull/2324))
55
+
56
+ ### Language updates
57
+
58
+ * Fix `define_method` method block self type ([#2325](https://github.com/ruby/rbs/pull/2325))
59
+
60
+ ## 3.9.0.pre.1 (2025-03-11)
61
+
62
+ ### Signature updates
63
+
64
+ * `CGI.escape/unescape_uri_component` ([#2299](https://github.com/ruby/rbs/pull/2299))
65
+ * `Enumerator::Chain` ([#2220](https://github.com/ruby/rbs/pull/2220))
66
+ * `IO.read` ([#2216](https://github.com/ruby/rbs/pull/2216))
67
+ * `IPAddr#netmask` ([#2311](https://github.com/ruby/rbs/pull/2311))
68
+ * `Kernel#gets`, `Kernel#readline`, `Kernel#readlines` ([#2212](https://github.com/ruby/rbs/pull/2212))
69
+ * `Net::HTTP.start` ([#2225](https://github.com/ruby/rbs/pull/2225))
70
+ * `OpenSSL::BN` ([#2267](https://github.com/ruby/rbs/pull/2267))
71
+ * `OpenSSL::PKey::{RSA,DSA,DH}#params` ([#2255](https://github.com/ruby/rbs/pull/2255))
72
+ * `UNIXSocket#send_io`, `UNIXSocket#recv_io` ([#2264](https://github.com/ruby/rbs/pull/2264))
73
+ * `URI.encode/decode_uri_component` ([#2299](https://github.com/ruby/rbs/pull/2299))
74
+ * Rename to reduce top-level interface and type alias ([#2250](https://github.com/ruby/rbs/pull/2250))
75
+
76
+ ### Language updates
77
+
78
+ * Let class/module alias decls, global decls, and constant decls be annotated ([#2302](https://github.com/ruby/rbs/pull/2302))
79
+ * Add `resolve-type-names: false` magic comment ([#2234](https://github.com/ruby/rbs/pull/2234))
80
+
81
+ ### Library changes
82
+
83
+ * Remove unused root variable ([#2307](https://github.com/ruby/rbs/pull/2307))
84
+ * Run Valgrind on CI and fix memory leaks ([#2309](https://github.com/ruby/rbs/pull/2309))
85
+ * Add information for VariableDuplicationError ([#2310](https://github.com/ruby/rbs/pull/2310))
86
+ * Reduce Array object allocation during parsing ([#2304](https://github.com/ruby/rbs/pull/2304))
87
+ * No class variable duplication validation ([#2305](https://github.com/ruby/rbs/pull/2305))
88
+ * Keep annotations during type name resolution ([#2303](https://github.com/ruby/rbs/pull/2303))
89
+ * Fix method annotations ([#2301](https://github.com/ruby/rbs/pull/2301))
90
+ * Fix class variable ([#2300](https://github.com/ruby/rbs/pull/2300))
91
+ * Add bundled gems to alumnus ([#2288](https://github.com/ruby/rbs/pull/2288))
92
+ * Exclude `attr_*` methods from duplicate checks. ([#2294](https://github.com/ruby/rbs/pull/2294))
93
+ * Validate superclass and module-self-type ([#2289](https://github.com/ruby/rbs/pull/2289))
94
+ * Remove case when `rubygems` and `set` ([#2279](https://github.com/ruby/rbs/pull/2279))
95
+ * Check variable duplication ([#2241](https://github.com/ruby/rbs/pull/2241))
96
+ * Validate variable types ([#2237](https://github.com/ruby/rbs/pull/2237))
97
+ * Remove call to `TypeParam#unchecked!` from C parser ([#2256](https://github.com/ruby/rbs/pull/2256))
98
+ * Remove call to `Any#todo!` from C parser ([#2249](https://github.com/ruby/rbs/pull/2249))
99
+ * [rbs/unit_test] Treat nil as a return value ([#2257](https://github.com/ruby/rbs/pull/2257))
100
+
101
+ ### Miscellaneous
102
+
103
+ * Apply rubocop style to RBS ([#2292](https://github.com/ruby/rbs/pull/2292))
104
+ * Eliminate external HTTP requests on test ([#2253](https://github.com/ruby/rbs/pull/2253))
105
+ * Prevent a warning: the block passed to 'map_type_name' .. may be ignored ([#2248](https://github.com/ruby/rbs/pull/2248))
106
+ * Update ruby version for rubocop ([#2251](https://github.com/ruby/rbs/pull/2251))
107
+ * Drop templates from package ([#2214](https://github.com/ruby/rbs/pull/2214))
108
+
109
+ ## 3.8.1 (2024-12-27)
110
+
111
+ ### Signature updates
112
+
113
+ * `Ractor.store_if_absent` ([#2206](https://github.com/ruby/rbs/pull/2206))
114
+ * `Time#iso860t1` ([#2207](https://github.com/ruby/rbs/pull/2207))
115
+ * `Time#xmlschema` ([#2207](https://github.com/ruby/rbs/pull/2207))
116
+
117
+ ### Miscellaneous
118
+
119
+ * Update rubocop-on-rbs ([#2200](https://github.com/ruby/rbs/pull/2200))
120
+ * Update docs based on Ruby 3.4.1 ([#2208](https://github.com/ruby/rbs/pull/2208))
121
+ * Ruby 3.4.1 ([#2206](https://github.com/ruby/rbs/pull/2206))
122
+
123
+ ## 3.8.0 (2024-12-24)
124
+
125
+ ### Signature updates
126
+
127
+ * `Dir.mktmpdir` ([#2158](https://github.com/ruby/rbs/pull/2158))
128
+ * `File.join` ([#2158](https://github.com/ruby/rbs/pull/2158))
129
+ * `IO#each_line` ([#2151](https://github.com/ruby/rbs/pull/2151))
130
+ * `Kernel#readlines` ([#2151](https://github.com/ruby/rbs/pull/2151))
131
+ * `Ractor.store_if_absent` ([#2198](https://github.com/ruby/rbs/pull/2198))
132
+ * Update docs as of 2024-12-24, 16:13 JST ([#2193](https://github.com/ruby/rbs/pull/2193))
133
+
134
+ ### Library changes
135
+
136
+ * Adjust capacity of location children ([#2197](https://github.com/ruby/rbs/pull/2197))
137
+ * Should validate self-type on Proc ([#2192](https://github.com/ruby/rbs/pull/2192))
138
+
139
+ ## 3.8.0.pre.1 (2024-12-19)
140
+
141
+ ### Signature updates
142
+
143
+ * `RubyVM::AbstractSyntaxTree::Location` ([#2189](https://github.com/ruby/rbs/pull/2189))
144
+ * `_JsonWrite#flush` ([#2134](https://github.com/ruby/rbs/pull/2134))
145
+ * `Array#fetch_values` ([#2189](https://github.com/ruby/rbs/pull/2189))
146
+ * `Array#to_csv` ([#2099](https://github.com/ruby/rbs/pull/2099))
147
+ * `Exception#set_backtrace` ([#2189](https://github.com/ruby/rbs/pull/2189))
148
+ * `Fiber#raise` ([#2189](https://github.com/ruby/rbs/pull/2189))
149
+ * `GC.config` ([#2189](https://github.com/ruby/rbs/pull/2189))
150
+ * `Hash.new` ([#2189](https://github.com/ruby/rbs/pull/2189))
151
+ * `Kernel#raise` ([#2189](https://github.com/ruby/rbs/pull/2189))
152
+ * `MatchData#bytebegin` ([#2189](https://github.com/ruby/rbs/pull/2189))
153
+ * `MatchData#byteend` ([#2189](https://github.com/ruby/rbs/pull/2189))
154
+ * `Pathname#mkpath` ([#2048](https://github.com/ruby/rbs/pull/2048))
155
+ * `Pathname#rmtree` ([#2048](https://github.com/ruby/rbs/pull/2048))
156
+ * `Ractor._require` ([#2189](https://github.com/ruby/rbs/pull/2189))
157
+ * `Ractor.[]` ([#2189](https://github.com/ruby/rbs/pull/2189))
158
+ * `Ractor.[]=` ([#2189](https://github.com/ruby/rbs/pull/2189))
159
+ * `Ractor.main?` ([#2189](https://github.com/ruby/rbs/pull/2189))
160
+ * `Range#step` ([#1958](https://github.com/ruby/rbs/pull/1958))
161
+ * `RubyVM::AbstractSyntaxTree::Node#locations` ([#2189](https://github.com/ruby/rbs/pull/2189))
162
+ * `String#append_as_bytes` ([#2189](https://github.com/ruby/rbs/pull/2189))
163
+ * `String#parse_csv` ([#2099](https://github.com/ruby/rbs/pull/2099))
164
+ * `String#scan` ([#2146](https://github.com/ruby/rbs/pull/2146))
165
+ * `Tempfile.create` ([#2189](https://github.com/ruby/rbs/pull/2189))
166
+ * `Thread#raise` ([#2189](https://github.com/ruby/rbs/pull/2189))
167
+ * `Time#iso8601` ([#2189](https://github.com/ruby/rbs/pull/2189))
168
+ * `Time#xmlschema` ([#2189](https://github.com/ruby/rbs/pull/2189))
169
+ * `Warning.categories` ([#2189](https://github.com/ruby/rbs/pull/2189))
170
+ * `ZStream#finish` ([#2136](https://github.com/ruby/rbs/pull/2136))
171
+ * Generate docs based on ruby 3.4.0-rc1 ([#2183](https://github.com/ruby/rbs/pull/2183))
172
+
173
+ ### Library changes
174
+
175
+ * Deprecate `Kernel#Namespace` ([#2123](https://github.com/ruby/rbs/pull/2123))
176
+ * Fix `missing braces around initializer` warning ([#2180](https://github.com/ruby/rbs/pull/2180))
177
+ * Avoid double name resolution ([#2127](https://github.com/ruby/rbs/pull/2127))
178
+ * Remove forward declarations of local variables ([#2132](https://github.com/ruby/rbs/pull/2132))
179
+ * Designated initializers ([#2131](https://github.com/ruby/rbs/pull/2131))
180
+
181
+ ### Miscellaneous
182
+
183
+ * Update docs with rdoc-6.10.0 ([#2182](https://github.com/ruby/rbs/pull/2182))
184
+ * Update rdoc ([#2160](https://github.com/ruby/rbs/pull/2160))
185
+ * Prepare for ruby 3.4.0 ([#2181](https://github.com/ruby/rbs/pull/2181))
186
+ * Fix typo in `instance` usage example ([#2139](https://github.com/ruby/rbs/pull/2139))
187
+ * Indent `parser_test` code snippets properly ([#2137](https://github.com/ruby/rbs/pull/2137))
188
+ * Bump rbs and steep in /steep ([#2129](https://github.com/ruby/rbs/pull/2129))
189
+ * Un-hardcode repo name in test suite ([#2128](https://github.com/ruby/rbs/pull/2128))
190
+
191
+ ## 3.7.0 (2024-12-05)
192
+
193
+ ### Miscellaneous
194
+
195
+ * bundle update mutex_m ([#2122](https://github.com/ruby/rbs/pull/2122))
196
+
197
+ ## 3.7.0.pre.1 (2024-12-05)
198
+
199
+ ### Signature updates
200
+
201
+ * `CGI.accept_charset` ([#2045](https://github.com/ruby/rbs/pull/2045))
202
+ * `IO#readline`, `IO#readlines` ([#2059](https://github.com/ruby/rbs/pull/2059))
203
+ * `Kernel#proc` ([#2036](https://github.com/ruby/rbs/pull/2036))
204
+ * `Kernel#system` ([#2075](https://github.com/ruby/rbs/pull/2075))
205
+ * `Object#to_yaml` ([#2107](https://github.com/ruby/rbs/pull/2107))
206
+ * `OpenSSL::Digest` ([#2108](https://github.com/ruby/rbs/pull/2108))
207
+ * `OpenSSL.base64digest` ([#2078](https://github.com/ruby/rbs/pull/2078))
208
+ * `Process.detach` ([#2083](https://github.com/ruby/rbs/pull/2083))
209
+
210
+ ### Library changes
211
+
212
+ * Reduce object allocation for record type ([#2118](https://github.com/ruby/rbs/pull/2118))
213
+ * Milestone to graduate stringio from core. ([#2114](https://github.com/ruby/rbs/pull/2114))
214
+ * Mark all internal `parse_` methods as `static` ([#2103](https://github.com/ruby/rbs/pull/2103))
215
+ * Add templating mechanism to automatically generate `.c`/`.h` files ([#2098](https://github.com/ruby/rbs/pull/2098))
216
+ * Remove unused `rbs_unescape_string` declaration ([#2058](https://github.com/ruby/rbs/pull/2058))
217
+ * Fix UntypedFunction does not provide #map_type_name ([#2054](https://github.com/ruby/rbs/pull/2054))
218
+ * Better `instance_eval`/`instance_exec` detection ([#2052](https://github.com/ruby/rbs/pull/2052))
219
+ * Overload annotations ([#2049](https://github.com/ruby/rbs/pull/2049))
220
+
221
+ #### rbs prototype
222
+
223
+ * prototype rb: Fix crashed by self::CONST ([#2079](https://github.com/ruby/rbs/pull/2079))
224
+
225
+ #### rbs collection
226
+
227
+ * mutex_m support ([#2115](https://github.com/ruby/rbs/pull/2115))
228
+
229
+ ### Miscellaneous
230
+
231
+ * Use `File.open` with block ([#2119](https://github.com/ruby/rbs/pull/2119))
232
+ * Compile without activesupport ([#2105](https://github.com/ruby/rbs/pull/2105))
233
+ * docs: Add singleton attribute members to syntax.md ([#2090](https://github.com/ruby/rbs/pull/2090))
234
+ * Bundle update rubocop-on-rbs ([#2094](https://github.com/ruby/rbs/pull/2094))
235
+ * `bundle exec` on windows ([#2101](https://github.com/ruby/rbs/pull/2101))
236
+ * Fix typos ([#2097](https://github.com/ruby/rbs/pull/2097))
237
+ * Bundle update json 2.8.2 ([#2095](https://github.com/ruby/rbs/pull/2095))
238
+ * Skip `rbs` gem validation ([#2084](https://github.com/ruby/rbs/pull/2084))
239
+ * Skip PTY_test with Windows platform ([#2055](https://github.com/ruby/rbs/pull/2055))
240
+ * Randomize stdlib test order to uncover hidden assumptions ([#2043](https://github.com/ruby/rbs/pull/2043))
241
+ * Suppress `inline` is not at beginning of declaration for melt_array ([#2050](https://github.com/ruby/rbs/pull/2050))
242
+ * Skip `mkpath` test with 3.4 ([#2053](https://github.com/ruby/rbs/pull/2053))
243
+
3
244
  ## 3.6.1 (2024-10-03)
4
245
 
5
246
  ### Library changes
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ bin = File.join(__dir__, "bin")
11
11
 
12
12
  Rake::ExtensionTask.new("rbs_extension")
13
13
 
14
- Rake::TestTask.new(:test => :compile) do |t|
14
+ test_config = lambda do |t|
15
15
  t.libs << "test"
16
16
  t.libs << "lib"
17
17
  t.test_files = FileList["test/**/*_test.rb"].reject do |path|
@@ -19,6 +19,20 @@ Rake::TestTask.new(:test => :compile) do |t|
19
19
  end
20
20
  end
21
21
 
22
+ Rake::TestTask.new(test: :compile, &test_config)
23
+
24
+ unless Gem.win_platform?
25
+ begin
26
+ require "ruby_memcheck"
27
+
28
+ namespace :test do
29
+ RubyMemcheck::TestTask.new(valgrind: :compile, &test_config)
30
+ end
31
+ rescue LoadError => exn
32
+ STDERR.puts "🚨🚨🚨🚨 Skipping RubyMemcheck: #{exn.inspect} 🚨🚨🚨🚨"
33
+ end
34
+ end
35
+
22
36
  multitask :default => [:test, :stdlib_test, :typecheck_test, :rubocop, :validate, :test_doc]
23
37
 
24
38
  task :lexer do
@@ -30,10 +44,22 @@ task :confirm_lexer => :lexer do
30
44
  sh "git diff --exit-code ext/rbs_extension/lexer.c"
31
45
  end
32
46
 
47
+ task :confirm_templates => :templates do
48
+ puts "Testing if generated code under include and src is updated with respect to templates"
49
+ sh "git diff --exit-code -- include src"
50
+ end
51
+
33
52
  rule ".c" => ".re" do |t|
34
53
  puts "⚠️⚠️⚠️ #{t.name} is older than #{t.source}. You may need to run `rake lexer` ⚠️⚠️⚠️"
35
54
  end
36
55
 
56
+ rule %r{^src/(.*)\.c} => 'templates/%X.c.erb' do |t|
57
+ puts "⚠️⚠️⚠️ #{t.name} is older than #{t.source}. You may need to run `rake templates` ⚠️⚠️⚠️"
58
+ end
59
+ rule %r{^include/(.*)\.c} => 'templates/%X.c.erb' do |t|
60
+ puts "⚠️⚠️⚠️ #{t.name} is older than #{t.source}. You may need to run `rake templates` ⚠️⚠️⚠️"
61
+ end
62
+
37
63
  task :annotate do
38
64
  sh "bin/generate_docs.sh"
39
65
  end
@@ -43,7 +69,18 @@ task :confirm_annotation do
43
69
  sh "git diff --exit-code core stdlib"
44
70
  end
45
71
 
72
+ task :templates do
73
+ sh "#{ruby} templates/template.rb include/rbs/constants.h"
74
+ sh "#{ruby} templates/template.rb include/rbs/ruby_objs.h"
75
+ sh "#{ruby} templates/template.rb src/constants.c"
76
+ sh "#{ruby} templates/template.rb src/ruby_objs.c"
77
+ end
78
+
46
79
  task :compile => "ext/rbs_extension/lexer.c"
80
+ task :compile => "include/rbs/constants.h"
81
+ task :compile => "include/rbs/ruby_objs.h"
82
+ task :compile => "src/constants.c"
83
+ task :compile => "src/ruby_objs.c"
47
84
 
48
85
  task :test_doc do
49
86
  files = Dir.chdir(File.expand_path('..', __FILE__)) do
@@ -63,7 +100,12 @@ task :validate => :compile do
63
100
  # Skip RBS validation because Ruby CI runs without rubygems
64
101
  case skip_rbs_validation = ENV["SKIP_RBS_VALIDATION"]
65
102
  when nil
66
- libs << "rbs"
103
+ begin
104
+ Gem::Specification.find_by_name("rbs")
105
+ libs << "rbs"
106
+ rescue Gem::MissingSpecError
107
+ STDERR.puts "🚨🚨🚨🚨 Skipping `rbs` gem because it's not found"
108
+ end
67
109
  when "true"
68
110
  # Skip
69
111
  else
@@ -84,10 +126,16 @@ end
84
126
 
85
127
  task :stdlib_test => :compile do
86
128
  test_files = FileList["test/stdlib/**/*_test.rb"].reject do |path|
87
- path =~ %r{Ractor} || path =~ %r{Encoding}
129
+ path =~ %r{Ractor} || path =~ %r{Encoding} || path =~ %r{CGI_test}
130
+ end
131
+
132
+ if ENV["RANDOMIZE_STDLIB_TEST_ORDER"] == "true"
133
+ test_files.shuffle!
88
134
  end
135
+
89
136
  sh "#{ruby} -Ilib #{bin}/test_runner.rb #{test_files.join(' ')}"
90
137
  # TODO: Ractor tests need to be run in a separate process
138
+ sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/CGI_test.rb"
91
139
  sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/Ractor_test.rb"
92
140
  sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/Encoding_test.rb"
93
141
  end
@@ -106,7 +154,9 @@ task :typecheck_test => :compile do
106
154
  end
107
155
 
108
156
  task :raap => :compile do
109
- sh %q[ruby test/raap.rb | xargs bundle exec raap -r digest/bubblebabble --library digest --allow-private]
157
+ sh "ruby test/raap/core.rb"
158
+ sh "ruby test/raap/digest.rb"
159
+ sh "ruby test/raap/openssl.rb"
110
160
  end
111
161
 
112
162
  task :rubocop do