rbs 3.10.0 → 4.0.0.dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +3 -3
  3. data/.github/workflows/ruby.yml +24 -35
  4. data/.github/workflows/typecheck.yml +3 -1
  5. data/.github/workflows/windows.yml +2 -2
  6. data/.gitignore +0 -4
  7. data/CHANGELOG.md +0 -88
  8. data/README.md +1 -38
  9. data/Rakefile +20 -142
  10. data/Steepfile +1 -0
  11. data/config.yml +43 -1
  12. data/core/array.rbs +46 -100
  13. data/core/complex.rbs +21 -32
  14. data/core/dir.rbs +2 -2
  15. data/core/encoding.rbs +9 -6
  16. data/core/enumerable.rbs +3 -90
  17. data/core/enumerator.rbs +1 -18
  18. data/core/errno.rbs +0 -8
  19. data/core/errors.rbs +1 -28
  20. data/core/exception.rbs +2 -2
  21. data/core/fiber.rbs +4 -5
  22. data/core/file.rbs +12 -27
  23. data/core/file_test.rbs +1 -1
  24. data/core/float.rbs +22 -209
  25. data/core/gc.rbs +281 -417
  26. data/core/hash.rbs +727 -1024
  27. data/core/integer.rbs +38 -78
  28. data/core/io/buffer.rbs +7 -18
  29. data/core/io/wait.rbs +33 -11
  30. data/core/io.rbs +12 -14
  31. data/core/kernel.rbs +51 -57
  32. data/core/marshal.rbs +1 -1
  33. data/core/match_data.rbs +1 -1
  34. data/core/math.rbs +3 -42
  35. data/core/method.rbs +6 -14
  36. data/core/module.rbs +17 -88
  37. data/core/nil_class.rbs +3 -3
  38. data/core/numeric.rbs +16 -16
  39. data/core/object.rbs +3 -3
  40. data/core/object_space.rbs +15 -21
  41. data/core/proc.rbs +8 -15
  42. data/core/process.rbs +2 -2
  43. data/core/ractor.rbs +437 -278
  44. data/core/range.rbs +8 -7
  45. data/core/rational.rbs +24 -37
  46. data/core/rbs/unnamed/argf.rbs +2 -2
  47. data/core/rbs/unnamed/env_class.rbs +1 -1
  48. data/core/rbs/unnamed/random.rbs +2 -4
  49. data/core/regexp.rbs +20 -25
  50. data/core/ruby_vm.rbs +4 -6
  51. data/core/rubygems/errors.rbs +70 -3
  52. data/core/rubygems/rubygems.rbs +79 -11
  53. data/core/rubygems/version.rbs +3 -2
  54. data/core/set.rbs +359 -488
  55. data/core/string.rbs +1228 -3153
  56. data/core/struct.rbs +1 -1
  57. data/core/symbol.rbs +4 -4
  58. data/core/thread.rbs +29 -92
  59. data/core/time.rbs +9 -35
  60. data/core/trace_point.rbs +4 -7
  61. data/core/unbound_method.rbs +6 -14
  62. data/docs/collection.md +2 -2
  63. data/docs/gem.md +1 -0
  64. data/docs/sigs.md +3 -3
  65. data/ext/rbs_extension/ast_translation.c +1077 -944
  66. data/ext/rbs_extension/ast_translation.h +0 -7
  67. data/ext/rbs_extension/class_constants.c +83 -71
  68. data/ext/rbs_extension/class_constants.h +7 -4
  69. data/ext/rbs_extension/extconf.rb +2 -24
  70. data/ext/rbs_extension/legacy_location.c +172 -173
  71. data/ext/rbs_extension/legacy_location.h +3 -8
  72. data/ext/rbs_extension/main.c +289 -239
  73. data/ext/rbs_extension/rbs_extension.h +0 -3
  74. data/ext/rbs_extension/rbs_string_bridging.h +0 -4
  75. data/include/rbs/ast.h +98 -37
  76. data/include/rbs/defines.h +12 -38
  77. data/include/rbs/lexer.h +114 -126
  78. data/include/rbs/location.h +14 -14
  79. data/include/rbs/parser.h +37 -21
  80. data/include/rbs/string.h +5 -3
  81. data/include/rbs/util/rbs_allocator.h +19 -40
  82. data/include/rbs/util/rbs_assert.h +1 -12
  83. data/include/rbs/util/rbs_constant_pool.h +3 -3
  84. data/include/rbs/util/rbs_encoding.h +1 -3
  85. data/include/rbs/util/rbs_unescape.h +1 -2
  86. data/lib/rbs/ast/ruby/annotations.rb +119 -0
  87. data/lib/rbs/ast/ruby/comment_block.rb +221 -0
  88. data/lib/rbs/ast/ruby/declarations.rb +86 -0
  89. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +24 -0
  90. data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
  91. data/lib/rbs/ast/ruby/members.rb +213 -0
  92. data/lib/rbs/buffer.rb +104 -24
  93. data/lib/rbs/cli/validate.rb +40 -35
  94. data/lib/rbs/cli.rb +5 -6
  95. data/lib/rbs/collection/config/lockfile_generator.rb +0 -1
  96. data/lib/rbs/collection.rb +0 -1
  97. data/lib/rbs/definition.rb +6 -1
  98. data/lib/rbs/definition_builder/ancestor_builder.rb +65 -62
  99. data/lib/rbs/definition_builder/method_builder.rb +45 -30
  100. data/lib/rbs/definition_builder.rb +44 -9
  101. data/lib/rbs/environment/class_entry.rb +69 -0
  102. data/lib/rbs/environment/module_entry.rb +66 -0
  103. data/lib/rbs/environment.rb +244 -218
  104. data/lib/rbs/environment_loader.rb +3 -3
  105. data/lib/rbs/errors.rb +5 -4
  106. data/lib/rbs/inline_parser/comment_association.rb +117 -0
  107. data/lib/rbs/inline_parser.rb +206 -0
  108. data/lib/rbs/location_aux.rb +35 -3
  109. data/lib/rbs/parser_aux.rb +11 -6
  110. data/lib/rbs/prototype/runtime.rb +2 -2
  111. data/lib/rbs/resolver/constant_resolver.rb +2 -2
  112. data/lib/rbs/resolver/type_name_resolver.rb +38 -124
  113. data/lib/rbs/source.rb +99 -0
  114. data/lib/rbs/subtractor.rb +4 -3
  115. data/lib/rbs/test/type_check.rb +0 -14
  116. data/lib/rbs/types.rb +1 -3
  117. data/lib/rbs/version.rb +1 -1
  118. data/lib/rbs.rb +13 -1
  119. data/lib/rdoc/discover.rb +1 -1
  120. data/lib/rdoc_plugin/parser.rb +1 -1
  121. data/rbs.gemspec +1 -0
  122. data/sig/ancestor_builder.rbs +1 -1
  123. data/sig/ast/ruby/annotations.rbs +110 -0
  124. data/sig/ast/ruby/comment_block.rbs +119 -0
  125. data/sig/ast/ruby/declarations.rbs +60 -0
  126. data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
  127. data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
  128. data/sig/ast/ruby/members.rbs +72 -0
  129. data/sig/buffer.rbs +63 -5
  130. data/sig/definition.rbs +1 -0
  131. data/sig/definition_builder.rbs +1 -1
  132. data/sig/environment/class_entry.rbs +50 -0
  133. data/sig/environment/module_entry.rbs +50 -0
  134. data/sig/environment.rbs +28 -133
  135. data/sig/errors.rbs +13 -6
  136. data/sig/inline_parser/comment_association.rbs +71 -0
  137. data/sig/inline_parser.rbs +87 -0
  138. data/sig/location.rbs +32 -7
  139. data/sig/manifest.yaml +1 -0
  140. data/sig/method_builder.rbs +7 -4
  141. data/sig/parser.rbs +16 -20
  142. data/sig/resolver/type_name_resolver.rbs +7 -38
  143. data/sig/source.rbs +48 -0
  144. data/sig/types.rbs +1 -4
  145. data/src/ast.c +290 -201
  146. data/src/lexer.c +2813 -2902
  147. data/src/lexer.re +4 -0
  148. data/src/lexstate.c +155 -169
  149. data/src/location.c +40 -40
  150. data/src/parser.c +2665 -2433
  151. data/src/string.c +48 -0
  152. data/src/util/rbs_allocator.c +77 -80
  153. data/src/util/rbs_assert.c +10 -10
  154. data/src/util/rbs_buffer.c +2 -2
  155. data/src/util/rbs_constant_pool.c +15 -13
  156. data/src/util/rbs_encoding.c +4062 -20097
  157. data/src/util/rbs_unescape.c +48 -85
  158. data/stdlib/bigdecimal/0/big_decimal.rbs +82 -100
  159. data/stdlib/bigdecimal-math/0/big_math.rbs +8 -169
  160. data/stdlib/cgi/0/core.rbs +396 -2
  161. data/stdlib/cgi/0/manifest.yaml +0 -1
  162. data/stdlib/coverage/0/coverage.rbs +1 -3
  163. data/stdlib/date/0/date.rbs +59 -67
  164. data/stdlib/date/0/date_time.rbs +1 -1
  165. data/stdlib/delegate/0/delegator.rbs +7 -10
  166. data/stdlib/erb/0/erb.rbs +347 -737
  167. data/stdlib/fileutils/0/fileutils.rbs +13 -18
  168. data/stdlib/forwardable/0/forwardable.rbs +0 -3
  169. data/stdlib/json/0/json.rbs +48 -68
  170. data/stdlib/net-http/0/net-http.rbs +0 -3
  171. data/stdlib/objspace/0/objspace.rbs +4 -9
  172. data/stdlib/open-uri/0/open-uri.rbs +0 -40
  173. data/stdlib/openssl/0/openssl.rbs +228 -331
  174. data/stdlib/optparse/0/optparse.rbs +3 -3
  175. data/{core → stdlib/pathname/0}/pathname.rbs +355 -255
  176. data/stdlib/psych/0/psych.rbs +3 -3
  177. data/stdlib/rdoc/0/rdoc.rbs +1 -1
  178. data/stdlib/resolv/0/resolv.rbs +68 -25
  179. data/stdlib/ripper/0/ripper.rbs +2 -5
  180. data/stdlib/singleton/0/singleton.rbs +0 -3
  181. data/stdlib/socket/0/socket.rbs +1 -13
  182. data/stdlib/socket/0/tcp_socket.rbs +2 -10
  183. data/stdlib/stringio/0/stringio.rbs +85 -1176
  184. data/stdlib/strscan/0/string_scanner.rbs +31 -31
  185. data/stdlib/tempfile/0/tempfile.rbs +3 -3
  186. data/stdlib/time/0/time.rbs +1 -1
  187. data/stdlib/timeout/0/timeout.rbs +7 -63
  188. data/stdlib/tsort/0/cyclic.rbs +0 -3
  189. data/stdlib/uri/0/common.rbs +2 -11
  190. data/stdlib/uri/0/file.rbs +1 -1
  191. data/stdlib/uri/0/generic.rbs +16 -17
  192. data/stdlib/uri/0/rfc2396_parser.rbs +7 -6
  193. data/stdlib/zlib/0/zstream.rbs +0 -1
  194. metadata +40 -12
  195. data/.clang-format +0 -74
  196. data/.clangd +0 -2
  197. data/.github/workflows/c-check.yml +0 -54
  198. data/core/ruby.rbs +0 -53
  199. data/docs/aliases.md +0 -79
  200. data/docs/encoding.md +0 -56
  201. data/ext/rbs_extension/compat.h +0 -10
  202. data/stdlib/cgi-escape/0/escape.rbs +0 -153
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9e4107a0a29610713b34bf84a13fd4e348257e56e865a40358e61312f158fe0
4
- data.tar.gz: d9776ace0cb6e68ba97cd4bcdd2ade5e41ba909dbf562914053d64afad118d1c
3
+ metadata.gz: d0f208999624a32e97044b8427ec19fa233e21a530a6383efe4ea5b9333ab1ce
4
+ data.tar.gz: d03954e5a4fa29a428085183a90a86b481849b0994e0d454cccca395412a31f0
5
5
  SHA512:
6
- metadata.gz: 8805e28d9b760da1aa847fb8fa5ed26f26a2dc7309a37d861a178a511bfac68181955324803b42f64aada55cdd8806522c682b0980457aded2279f6493611eb0
7
- data.tar.gz: 4ffa069bffbcaa8e869d30f50dbe42344f624691acea5e9aa1ff8c665f4749c32c8450d5b2dab0e6ed3fc94e4bc67f8c82a833ac5cb167f35c4cb17eaeb59d45
6
+ metadata.gz: 56da6e8a6a9336ae251d766b85c0d8ab62b42a8df1f1c828cd8f0c0ce898ac639a024c5b819e2e6a85733fa1d140ca5b06fc61de62b36fdb21074d34710bb003
7
+ data.tar.gz: de3ac4191be3ec60ab8bd25c4653cc2663effc2004c9d5e33d9fbb6eabace99fa883dfd5201d92c7f574d8730a74116867a853cb525343a639aeef6d0dd6d041
@@ -10,13 +10,13 @@ on:
10
10
  jobs:
11
11
  comments:
12
12
  runs-on: "ubuntu-latest"
13
- env:
14
- RUBY_COMMIT: v4.0.0-preview3
13
+ # env:
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: "4.0.0-preview3"
19
+ ruby-version: "3.4.1"
20
20
  bundler: none
21
21
  - name: Install dependencies
22
22
  run: |
@@ -13,24 +13,26 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby: ['3.2', '3.3', '3.4', '4.0.0-preview3', 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: "4.0.0-preview3"
23
+ - ruby: "3.4"
24
24
  job: stdlib_test
25
- - ruby: "4.0.0-preview3"
25
+ - ruby: "3.4"
26
26
  job: test
27
27
  rubyopt: "--enable-frozen-string-literal"
28
- - ruby: "4.0.0-preview3"
28
+ - ruby: "3.4"
29
29
  job: stdlib_test
30
30
  rubyopt: "--enable-frozen-string-literal"
31
- - ruby: "4.0.0-preview3"
31
+ - ruby: "3.4"
32
+ job: lexer templates compile confirm_lexer confirm_templates
33
+ - ruby: "3.4"
32
34
  job: rubocop validate test_doc build test_generate_stdlib raap
33
- - ruby: "4.0.0-preview3"
35
+ - ruby: "3.4"
34
36
  job: typecheck_test
35
37
  env:
36
38
  RANDOMIZE_STDLIB_TEST_ORDER: "true"
@@ -42,10 +44,23 @@ jobs:
42
44
  bundler: none
43
45
  - name: Set working directory as safe
44
46
  run: git config --global --add safe.directory $(pwd)
47
+ - name: Set up permission
48
+ run: chmod -R o-w /opt/hostedtoolcache/Ruby
45
49
  - name: Install dependencies
46
50
  run: |
47
51
  sudo apt-get update
48
52
  sudo apt-get install -y libdb-dev curl autoconf automake m4 libtool python3
53
+ - name: Install Re2c
54
+ if: ${{ contains(matrix.job, 'lexer') }}
55
+ run: |
56
+ cd /tmp
57
+ curl -L https://github.com/skvadrik/re2c/archive/refs/tags/3.1.tar.gz > re2c-3.1.tar.gz
58
+ tar xf re2c-3.1.tar.gz
59
+ cd re2c-3.1
60
+ autoreconf -i -W all
61
+ ./configure
62
+ make
63
+ sudo make install
49
64
  - name: Update rubygems & bundler
50
65
  run: |
51
66
  ruby -v
@@ -68,13 +83,15 @@ jobs:
68
83
  valgrind:
69
84
  runs-on: ubuntu-latest
70
85
  steps:
71
- - uses: actions/checkout@v2
86
+ - uses: actions/checkout@v4
72
87
  - uses: ruby/setup-ruby@v1
73
88
  with:
74
89
  ruby-version: "3.4"
75
90
  bundler-cache: none
76
91
  - name: Set working directory as safe
77
92
  run: git config --global --add safe.directory $(pwd)
93
+ - name: Set up permission
94
+ run: chmod -R o-w /opt/hostedtoolcache/Ruby
78
95
  - name: Install dependencies
79
96
  run: |
80
97
  sudo apt-get update
@@ -89,31 +106,3 @@ jobs:
89
106
  - run: bundle exec rake test:valgrind
90
107
  env:
91
108
  RUBY_FREE_AT_EXIT: 1
92
- C99_compile:
93
- runs-on: macos-latest
94
- strategy:
95
- fail-fast: false
96
- matrix:
97
- ruby: ['4.0.0-preview3', head]
98
- steps:
99
- - uses: actions/checkout@v4
100
- - name: Install dependencies
101
- run: |
102
- brew install ruby-build
103
- - uses: ruby/setup-ruby@v1
104
- with:
105
- ruby-version: ${{ matrix.ruby }}
106
- bundler: none
107
- - name: Set working directory as safe
108
- run: git config --global --add safe.directory $(pwd)
109
- - name: Update rubygems & bundler
110
- run: |
111
- ruby -v
112
- gem update --system
113
- - name: clang version
114
- run: clang --version
115
- - name: bin/setup
116
- run: |
117
- bin/setup
118
- - run: bundle exec rake clean compile_c99
119
-
@@ -16,10 +16,12 @@ jobs:
16
16
  - uses: actions/checkout@v4
17
17
  - uses: ruby/setup-ruby@v1
18
18
  with:
19
- ruby-version: "3.4"
19
+ ruby-version: "3.3"
20
20
  bundler: none
21
21
  - name: Set working directory as safe
22
22
  run: git config --global --add safe.directory $(pwd)
23
+ - name: Set up permission
24
+ run: chmod -R o-w /opt/hostedtoolcache/Ruby
23
25
  - name: Install dependencies
24
26
  run: |
25
27
  sudo apt-get update
@@ -13,7 +13,7 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby: ['3.4', ucrt, mswin]
16
+ ruby: ['3.2', '3.3', ucrt, mswin]
17
17
  steps:
18
18
  - uses: actions/checkout@v4
19
19
  - name: load ruby
@@ -33,7 +33,7 @@ jobs:
33
33
 
34
34
  res = URI.parse("https://stdgems.org/bundled_gems.json").read
35
35
  bundled_gems = JSON.parse(res)["gems"].map{_1["gem"]}
36
- system "gem uninstall --force #{bundled_gems.join(" ")}", exception: true
36
+ system "gem uninstall #{bundled_gems.join(" ")} --force", exception: true
37
37
  '
38
38
  - name: bundle install
39
39
  run: |
data/.gitignore CHANGED
@@ -21,7 +21,3 @@ lib/**/*.dll
21
21
  doc/
22
22
 
23
23
  **/*.gem
24
-
25
- # For clangd's editor integration
26
- ext/rbs_extension/compile_commands.json
27
- ext/rbs_extension/.cache
data/CHANGELOG.md CHANGED
@@ -1,93 +1,5 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 3.10.0 (2025-12-23)
4
-
5
- RBS 3.10.0 ships with a pure C parser implementation, signature updates for Ruby 4.0, and various bug fixes.
6
-
7
- ### Pure C parser implementation
8
-
9
- The new parser implementation was announced at [RubyKaigi 2025](https://rubykaigi.org/2025/presentations/amomchilov.html) and is finally shipped as a RubyGem!
10
-
11
- The new parser is faster than the one in 3.9 and is portable — it is independent of the Ruby runtime and is used to implement Sorbet’s RBS support.
12
-
13
- ### Type definition of bundled gems
14
-
15
- The type definitions of `cgi` have been moved to [gem_rbs_collection](https://github.com/ruby/gem_rbs_collection/tree/main/gems/cgi), as it has been migrated to a bundled gem in Ruby 4.0
16
-
17
- `cgi-escape` has been added to `stdlib`. You may need to declare a dependency on `cgi-escape` in your `manifest.yaml`, add `-r cgi-escape` to your command line, or update your type checker configuration.
18
-
19
- ```yaml
20
- dependencies:
21
- - name: cgi-escape
22
- ```
23
-
24
- The type definitions for `pathname` have also been moved from `stdlib` to `core`, as it is now implemented as part of the core library.
25
-
26
- ### Pull Requests
27
-
28
- * [Backport] Support rdoc v7 ([#2770](https://github.com/ruby/rbs/pull/2770))
29
- * [Backport] Check tuple type length ([#2766](https://github.com/ruby/rbs/pull/2766))
30
- * Backport update to 4.0.0-preview3 ([#2768](https://github.com/ruby/rbs/pull/2768))
31
- * [Backport] Remove test code for bundled gems ([#2762](https://github.com/ruby/rbs/pull/2762))
32
- * Merge pull request #2761 from ruby/update-minitest ([#2763](https://github.com/ruby/rbs/pull/2763))
33
- * [Backport] Support BigDecimal v4 ([#2759](https://github.com/ruby/rbs/pull/2759))
34
- * Parser/lexer backports ([#2756](https://github.com/ruby/rbs/pull/2756))
35
- * Merge pull request #2753 from ruby/delete-printf ([#2754](https://github.com/ruby/rbs/pull/2754))
36
- * Backports ([#2751](https://github.com/ruby/rbs/pull/2751))
37
- * Merge pull request #2728 from ruby/cgi ([#2747](https://github.com/ruby/rbs/pull/2747))
38
- * Merge pull request #2729 from ruby/rbs-assert ([#2748](https://github.com/ruby/rbs/pull/2748))
39
- * Merge pull request #2749 from ruby/fix-test ([#2750](https://github.com/ruby/rbs/pull/2750))
40
- * Backport RBS file updates ([#2742](https://github.com/ruby/rbs/pull/2742))
41
- * Backport JSON PRs ([#2740](https://github.com/ruby/rbs/pull/2740))
42
- * Merge pull request #2718 from ruby/ruby-4 ([#2741](https://github.com/ruby/rbs/pull/2741))
43
- * [Backport] Move Pathname to core from stdlib ([#2730](https://github.com/ruby/rbs/pull/2730))
44
- * Backport rdoc 6.16 ([#2722](https://github.com/ruby/rbs/pull/2722))
45
- * Backport rdoc support ([#2719](https://github.com/ruby/rbs/pull/2719))
46
- * Backport "Remove sig for IO#{ready?,nread}" ([#2720](https://github.com/ruby/rbs/pull/2720))
47
- * Backport more pure C parsers ([#2679](https://github.com/ruby/rbs/pull/2679))
48
- * Backport module name normalization ([#2673](https://github.com/ruby/rbs/pull/2673))
49
- * Backport pure-C parser ([#2671](https://github.com/ruby/rbs/pull/2671))
50
- * Fix test failure ([#2672](https://github.com/ruby/rbs/pull/2672))
51
-
52
- ## 3.9.5 (2025-09-08)
53
-
54
- ### Signature updates
55
-
56
- * Merge pull request #2655 from ruby/silence-string-deprecation ([#2656](https://github.com/ruby/rbs/pull/2656))
57
-
58
- ### Miscellaneous
59
-
60
- * Allows the use of a path list as RBS_SKIP_TESTS ([#2641](https://github.com/ruby/rbs/pull/2641))
61
- * Suppress to GCC warning with multi-line comment ([#2646](https://github.com/ruby/rbs/pull/2646))
62
- * Backport to 3.9 ([#2487](https://github.com/ruby/rbs/pull/2487))
63
- * Use erb instead of set for load path testing ([#2468](https://github.com/ruby/rbs/pull/2468))
64
-
65
- ## 3.9.4 (2025-05-15)
66
-
67
- ### Miscellaneous
68
-
69
- * Backport test/CI fixes to 3.9 ([#2487](https://github.com/ruby/rbs/pull/2487))
70
- * Use erb instead of set for load path testing ([#2468](https://github.com/ruby/rbs/pull/2468))
71
-
72
- ## 3.9.3 (2025-05-09)
73
-
74
- ### Miscellaneous
75
-
76
- * Use erb instead of set for load path testing ([#2468](https://github.com/ruby/rbs/pull/2468))
77
-
78
- ## 3.9.2 (2025-03-31)
79
-
80
- ### Library changes
81
-
82
- * Change `{}` to `{ 0 }` ([#2354](https://github.com/ruby/rbs/pull/2354))
83
-
84
- ## 3.9.1 (2025-03-24)
85
-
86
- ### Miscellaneous
87
-
88
- * `did_you_mean` is a default gem ([#2348](https://github.com/ruby/rbs/pull/2348))
89
- * Skip loading ruby_memcheck ([#2347](https://github.com/ruby/rbs/pull/2347))
90
-
91
3
  ## 3.9.0 (2025-03-18)
92
4
 
93
5
  ### Miscellaneous
data/README.md CHANGED
@@ -141,7 +141,7 @@ require "rbs"
141
141
  loader = RBS::EnvironmentLoader.new()
142
142
 
143
143
  # loader.add(path: Pathname("sig")) # Load .rbs files from `sig` directory
144
- # loader.add(library: "logger") # Load logger library
144
+ # loader.add(library: "pathname") # Load pathname library
145
145
 
146
146
  environment = RBS::Environment.from_loader(loader).resolve_type_names
147
147
 
@@ -198,43 +198,6 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
198
198
 
199
199
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
200
200
 
201
- ### C Code Formatting
202
-
203
- This project uses `clang-format` to enforce consistent formatting of C code with a `.clang-format` configuration in the root directory.
204
-
205
- #### Setup
206
-
207
- First, install clang-format:
208
-
209
- ```bash
210
- # macOS
211
- brew install clang-format
212
-
213
- # Ubuntu/Debian
214
- sudo apt-get install clang-format
215
-
216
- # Windows
217
- choco install llvm
218
- ```
219
-
220
- #### Usage
221
-
222
- Format all C source files:
223
-
224
- ```bash
225
- rake format:c
226
- ```
227
-
228
- Check formatting without making changes:
229
-
230
- ```bash
231
- rake format:c_check
232
- ```
233
-
234
- #### Editor Integration
235
-
236
- For VS Code users, install the "clangd" extension which will automatically use the project's `.clang-format` file.
237
-
238
201
  ## Contributing
239
202
 
240
203
  Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/rbs.
data/Rakefile CHANGED
@@ -11,26 +11,12 @@ bin = File.join(__dir__, "bin")
11
11
 
12
12
  Rake::ExtensionTask.new("rbs_extension")
13
13
 
14
- compile_task = Rake::Task[:compile]
15
-
16
- task :setup_extconf_compile_commands_json do
17
- ENV["COMPILE_COMMANDS_JSON"] = "1"
18
- end
19
-
20
- compile_task.prerequisites.unshift(:setup_extconf_compile_commands_json)
21
-
22
14
  test_config = lambda do |t|
23
15
  t.libs << "test"
24
16
  t.libs << "lib"
25
17
  t.test_files = FileList["test/**/*_test.rb"].reject do |path|
26
18
  path =~ %r{test/stdlib/}
27
19
  end
28
- if defined?(RubyMemcheck)
29
- if t.is_a?(RubyMemcheck::TestTask)
30
- t.verbose = true
31
- t.options = '-v'
32
- end
33
- end
34
20
  end
35
21
 
36
22
  Rake::TestTask.new(test: :compile, &test_config)
@@ -51,7 +37,6 @@ multitask :default => [:test, :stdlib_test, :typecheck_test, :rubocop, :validate
51
37
 
52
38
  task :lexer do
53
39
  sh "re2c -W --no-generation-date -o src/lexer.c src/lexer.re"
54
- sh "clang-format -i -style=file src/lexer.c"
55
40
  end
56
41
 
57
42
  task :confirm_lexer => :lexer do
@@ -64,84 +49,6 @@ task :confirm_templates => :templates do
64
49
  sh "git diff --exit-code -- include src"
65
50
  end
66
51
 
67
- # Task to format C code using clang-format
68
- namespace :format do
69
- dirs = ["src", "ext", "include"]
70
-
71
- # Find all C source and header files
72
- files = `find #{dirs.join(" ")} -type f \\( -name "*.c" -o -name "*.h" \\)`.split("\n")
73
-
74
- desc "Format C source files using clang-format"
75
- task :c do
76
- puts "Formatting C files..."
77
-
78
- # Check if clang-format is installed
79
- unless system("which clang-format > /dev/null 2>&1")
80
- abort "Error: clang-format not found. Please install clang-format first."
81
- end
82
-
83
- if files.empty?
84
- puts "No C files found to format"
85
- next
86
- end
87
-
88
- puts "Found #{files.length} files to format (excluding generated files)"
89
-
90
- exit_status = 0
91
- files.each do |file|
92
- puts "Formatting #{file}"
93
- unless system("clang-format -i -style=file #{file}")
94
- puts "❌ Error formatting #{file}"
95
- exit_status = 1
96
- end
97
- end
98
-
99
- exit exit_status unless exit_status == 0
100
- puts "✅ All files formatted successfully"
101
- end
102
-
103
- desc "Check if C source files are properly formatted"
104
- task :c_check do
105
- puts "Checking C file formatting..."
106
-
107
- # Check if clang-format is installed
108
- unless system("which clang-format > /dev/null 2>&1")
109
- abort "Error: clang-format not found. Please install clang-format first."
110
- end
111
-
112
- if files.empty?
113
- puts "No C files found to check"
114
- next
115
- end
116
-
117
- puts "Found #{files.length} files to check (excluding generated files)"
118
-
119
- needs_format = false
120
- files.each do |file|
121
- formatted = `clang-format -style=file #{file}`
122
- original = File.read(file)
123
-
124
- if formatted != original
125
- puts "❌ #{file} needs formatting"
126
- puts "Diff:"
127
- # Save formatted version to temp file and run diff
128
- temp_file = "#{file}.formatted"
129
- File.write(temp_file, formatted)
130
- system("diff -u #{file} #{temp_file}")
131
- File.unlink(temp_file)
132
- needs_format = true
133
- end
134
- end
135
-
136
- if needs_format
137
- warn "Some files need formatting. Run 'rake format:c' to format them."
138
- exit 1
139
- else
140
- puts "✅ All files are properly formatted"
141
- end
142
- end
143
- end
144
-
145
52
  rule ".c" => ".re" do |t|
146
53
  puts "⚠️⚠️⚠️ #{t.name} is older than #{t.source}. You may need to run `rake lexer` ⚠️⚠️⚠️"
147
54
  end
@@ -171,9 +78,6 @@ task :templates do
171
78
 
172
79
  sh "#{ruby} templates/template.rb include/rbs/ast.h"
173
80
  sh "#{ruby} templates/template.rb src/ast.c"
174
-
175
- # Format the generated files
176
- Rake::Task["format:c"].invoke
177
81
  end
178
82
 
179
83
  task :compile => "ext/rbs_extension/class_constants.h"
@@ -212,14 +116,7 @@ task :validate => :compile do
212
116
  end
213
117
 
214
118
  libs.each do |lib|
215
- args = ["-r", lib]
216
-
217
- if lib == "rbs"
218
- args << "-r"
219
- args << "prism"
220
- end
221
-
222
- sh "#{ruby} #{rbs} #{args.join(' ')} validate --exit-error-on-syntax-error"
119
+ sh "#{ruby} #{rbs} -r #{lib} validate --exit-error-on-syntax-error"
223
120
  end
224
121
  end
225
122
 
@@ -231,7 +128,7 @@ end
231
128
 
232
129
  task :stdlib_test => :compile do
233
130
  test_files = FileList["test/stdlib/**/*_test.rb"].reject do |path|
234
- path =~ %r{Ractor} || path =~ %r{Encoding} || path =~ %r{CGI-escape_test}
131
+ path =~ %r{Ractor} || path =~ %r{Encoding} || path =~ %r{CGI_test}
235
132
  end
236
133
 
237
134
  if ENV["RANDOMIZE_STDLIB_TEST_ORDER"] == "true"
@@ -240,24 +137,27 @@ task :stdlib_test => :compile do
240
137
 
241
138
  sh "#{ruby} -Ilib #{bin}/test_runner.rb #{test_files.join(' ')}"
242
139
  # TODO: Ractor tests need to be run in a separate process
243
- sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/CGI-escape_test.rb"
140
+ sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/CGI_test.rb"
244
141
  sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/Ractor_test.rb"
245
142
  sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/Encoding_test.rb"
246
143
  end
247
144
 
248
145
  task :typecheck_test => :compile do
249
- Bundler.with_unbundled_env do
250
- FileList["test/typecheck/*"].each do |test|
251
- Dir.chdir(test) do
252
- expectations = File.join(test, "steep_expectations.yml")
253
- if File.exist?(expectations)
254
- sh "#{__dir__}/bin/steep check --with_expectations"
255
- else
256
- sh "#{__dir__}/bin/steep check"
257
- end
258
- end
259
- end
260
- end
146
+ puts
147
+ puts
148
+ puts "⛔️⛔️⛔️⛔️⛔️⛔️ Skipping type check test because RBS is incompatible with Steep (#{__FILE__}:#{__LINE__})"
149
+ puts
150
+ puts
151
+ # FileList["test/typecheck/*"].each do |test|
152
+ # Dir.chdir(test) do
153
+ # expectations = File.join(test, "steep_expectations.yml")
154
+ # if File.exist?(expectations)
155
+ # sh "steep check --with_expectations"
156
+ # else
157
+ # sh "steep check"
158
+ # end
159
+ # end
160
+ # end
261
161
  end
262
162
 
263
163
  task :raap => :compile do
@@ -335,7 +235,7 @@ namespace :generate do
335
235
  class <%= target %>SingletonTest < Test::Unit::TestCase
336
236
  include TestHelper
337
237
 
338
- # library "logger", "securerandom" # Declare library signatures to load
238
+ # library "pathname", "securerandom" # Declare library signatures to load
339
239
  testing "singleton(::<%= target %>)"
340
240
 
341
241
  <%- class_methods.each do |method_name, definition| -%>
@@ -354,7 +254,7 @@ namespace :generate do
354
254
  class <%= target %>Test < Test::Unit::TestCase
355
255
  include TestHelper
356
256
 
357
- # library "logger", "securerandom" # Declare library signatures to load
257
+ # library "pathname", "securerandom" # Declare library signatures to load
358
258
  testing "::<%= target %>"
359
259
 
360
260
  <%- instance_methods.each do |method_name, definition| -%>
@@ -537,25 +437,3 @@ task :changelog do
537
437
  puts " (🤑 There is no *unreleased* pull request associated to the milestone.)"
538
438
  end
539
439
  end
540
-
541
- desc "Compile extension without C23 extensions"
542
- task :compile_c99 do
543
- ENV["TEST_NO_C23"] = "true"
544
- Rake::Task[:"compile"].invoke
545
- ensure
546
- ENV.delete("TEST_NO_C23")
547
- end
548
-
549
- task :prepare_bench do
550
- ENV.delete("DEBUG")
551
- Rake::Task[:"clobber"].invoke
552
- Rake::Task[:"templates"].invoke
553
- Rake::Task[:"compile"].invoke
554
- end
555
-
556
- task :prepare_profiling do
557
- ENV["DEBUG"] = "1"
558
- Rake::Task[:"clobber"].invoke
559
- Rake::Task[:"templates"].invoke
560
- Rake::Task[:"compile"].invoke
561
- end
data/Steepfile CHANGED
@@ -9,6 +9,7 @@ target :lib do
9
9
  )
10
10
 
11
11
  library "pathname", "json", "logger", "monitor", "tsort", "uri", 'dbm', 'pstore', 'singleton', 'shellwords', 'fileutils', 'find', 'digest', 'prettyprint', 'yaml', "psych", "securerandom"
12
+ library "prism"
12
13
  signature "stdlib/strscan/0/"
13
14
  signature "stdlib/optparse/0/"
14
15
  signature "stdlib/rdoc/0/"
data/config.yml CHANGED
@@ -345,7 +345,7 @@ nodes:
345
345
  - name: RBS::Types::Bases::Top
346
346
  - name: RBS::Types::Bases::Void
347
347
  - name: RBS::Types::Block
348
- expose_location: true
348
+ expose_location: false
349
349
  fields:
350
350
  - name: type
351
351
  c_type: rbs_node
@@ -443,3 +443,45 @@ nodes:
443
443
  fields:
444
444
  - name: name
445
445
  c_type: rbs_ast_symbol
446
+ - name: RBS::AST::Ruby::Annotations::NodeTypeAssertion
447
+ fields:
448
+ - name: prefix_location
449
+ c_type: rbs_location
450
+ - name: type
451
+ c_type: rbs_node
452
+ - name: RBS::AST::Ruby::Annotations::ColonMethodTypeAnnotation
453
+ fields:
454
+ - name: prefix_location
455
+ c_type: rbs_location
456
+ - name: annotations
457
+ c_type: rbs_node_list
458
+ - name: method_type
459
+ c_type: rbs_node
460
+ - name: RBS::AST::Ruby::Annotations::MethodTypesAnnotation
461
+ fields:
462
+ - name: prefix_location
463
+ c_type: rbs_location
464
+ - name: overloads
465
+ c_type: rbs_node_list
466
+ - name: vertical_bar_locations
467
+ c_type: rbs_location_list
468
+ - name: RBS::AST::Ruby::Annotations::SkipAnnotation
469
+ fields:
470
+ - name: prefix_location
471
+ c_type: rbs_location
472
+ - name: skip_location
473
+ c_type: rbs_location
474
+ - name: comment_location
475
+ c_type: rbs_location
476
+ - name: RBS::AST::Ruby::Annotations::ReturnTypeAnnotation
477
+ fields:
478
+ - name: prefix_location
479
+ c_type: rbs_location
480
+ - name: return_location
481
+ c_type: rbs_location
482
+ - name: colon_location
483
+ c_type: rbs_location
484
+ - name: return_type
485
+ c_type: rbs_node
486
+ - name: comment_location
487
+ c_type: rbs_location