rbs 3.10.0 → 4.0.0.dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +3 -3
- data/.github/workflows/ruby.yml +24 -35
- data/.github/workflows/typecheck.yml +3 -1
- data/.github/workflows/windows.yml +2 -2
- data/.gitignore +0 -4
- data/CHANGELOG.md +0 -88
- data/README.md +1 -38
- data/Rakefile +20 -142
- data/Steepfile +1 -0
- data/config.yml +43 -1
- data/core/array.rbs +46 -100
- data/core/complex.rbs +21 -32
- data/core/dir.rbs +2 -2
- data/core/encoding.rbs +9 -6
- data/core/enumerable.rbs +3 -90
- data/core/enumerator.rbs +1 -18
- data/core/errno.rbs +0 -8
- data/core/errors.rbs +1 -28
- data/core/exception.rbs +2 -2
- data/core/fiber.rbs +4 -5
- data/core/file.rbs +12 -27
- data/core/file_test.rbs +1 -1
- data/core/float.rbs +22 -209
- data/core/gc.rbs +281 -417
- data/core/hash.rbs +727 -1024
- data/core/integer.rbs +38 -78
- data/core/io/buffer.rbs +7 -18
- data/core/io/wait.rbs +33 -11
- data/core/io.rbs +12 -14
- data/core/kernel.rbs +51 -57
- data/core/marshal.rbs +1 -1
- data/core/match_data.rbs +1 -1
- data/core/math.rbs +3 -42
- data/core/method.rbs +6 -14
- data/core/module.rbs +17 -88
- data/core/nil_class.rbs +3 -3
- data/core/numeric.rbs +16 -16
- data/core/object.rbs +3 -3
- data/core/object_space.rbs +15 -21
- data/core/proc.rbs +8 -15
- data/core/process.rbs +2 -2
- data/core/ractor.rbs +437 -278
- data/core/range.rbs +8 -7
- data/core/rational.rbs +24 -37
- data/core/rbs/unnamed/argf.rbs +2 -2
- data/core/rbs/unnamed/env_class.rbs +1 -1
- data/core/rbs/unnamed/random.rbs +2 -4
- data/core/regexp.rbs +20 -25
- data/core/ruby_vm.rbs +4 -6
- data/core/rubygems/errors.rbs +70 -3
- data/core/rubygems/rubygems.rbs +79 -11
- data/core/rubygems/version.rbs +3 -2
- data/core/set.rbs +359 -488
- data/core/string.rbs +1228 -3153
- data/core/struct.rbs +1 -1
- data/core/symbol.rbs +4 -4
- data/core/thread.rbs +29 -92
- data/core/time.rbs +9 -35
- data/core/trace_point.rbs +4 -7
- data/core/unbound_method.rbs +6 -14
- data/docs/collection.md +2 -2
- data/docs/gem.md +1 -0
- data/docs/sigs.md +3 -3
- data/ext/rbs_extension/ast_translation.c +1077 -944
- data/ext/rbs_extension/ast_translation.h +0 -7
- data/ext/rbs_extension/class_constants.c +83 -71
- data/ext/rbs_extension/class_constants.h +7 -4
- data/ext/rbs_extension/extconf.rb +2 -24
- data/ext/rbs_extension/legacy_location.c +172 -173
- data/ext/rbs_extension/legacy_location.h +3 -8
- data/ext/rbs_extension/main.c +289 -239
- data/ext/rbs_extension/rbs_extension.h +0 -3
- data/ext/rbs_extension/rbs_string_bridging.h +0 -4
- data/include/rbs/ast.h +98 -37
- data/include/rbs/defines.h +12 -38
- data/include/rbs/lexer.h +114 -126
- data/include/rbs/location.h +14 -14
- data/include/rbs/parser.h +37 -21
- data/include/rbs/string.h +5 -3
- data/include/rbs/util/rbs_allocator.h +19 -40
- data/include/rbs/util/rbs_assert.h +1 -12
- data/include/rbs/util/rbs_constant_pool.h +3 -3
- data/include/rbs/util/rbs_encoding.h +1 -3
- data/include/rbs/util/rbs_unescape.h +1 -2
- data/lib/rbs/ast/ruby/annotations.rb +119 -0
- data/lib/rbs/ast/ruby/comment_block.rb +221 -0
- data/lib/rbs/ast/ruby/declarations.rb +86 -0
- data/lib/rbs/ast/ruby/helpers/constant_helper.rb +24 -0
- data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
- data/lib/rbs/ast/ruby/members.rb +213 -0
- data/lib/rbs/buffer.rb +104 -24
- data/lib/rbs/cli/validate.rb +40 -35
- data/lib/rbs/cli.rb +5 -6
- data/lib/rbs/collection/config/lockfile_generator.rb +0 -1
- data/lib/rbs/collection.rb +0 -1
- data/lib/rbs/definition.rb +6 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +65 -62
- data/lib/rbs/definition_builder/method_builder.rb +45 -30
- data/lib/rbs/definition_builder.rb +44 -9
- data/lib/rbs/environment/class_entry.rb +69 -0
- data/lib/rbs/environment/module_entry.rb +66 -0
- data/lib/rbs/environment.rb +244 -218
- data/lib/rbs/environment_loader.rb +3 -3
- data/lib/rbs/errors.rb +5 -4
- data/lib/rbs/inline_parser/comment_association.rb +117 -0
- data/lib/rbs/inline_parser.rb +206 -0
- data/lib/rbs/location_aux.rb +35 -3
- data/lib/rbs/parser_aux.rb +11 -6
- data/lib/rbs/prototype/runtime.rb +2 -2
- data/lib/rbs/resolver/constant_resolver.rb +2 -2
- data/lib/rbs/resolver/type_name_resolver.rb +38 -124
- data/lib/rbs/source.rb +99 -0
- data/lib/rbs/subtractor.rb +4 -3
- data/lib/rbs/test/type_check.rb +0 -14
- data/lib/rbs/types.rb +1 -3
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +13 -1
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +1 -1
- data/rbs.gemspec +1 -0
- data/sig/ancestor_builder.rbs +1 -1
- data/sig/ast/ruby/annotations.rbs +110 -0
- data/sig/ast/ruby/comment_block.rbs +119 -0
- data/sig/ast/ruby/declarations.rbs +60 -0
- data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
- data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
- data/sig/ast/ruby/members.rbs +72 -0
- data/sig/buffer.rbs +63 -5
- data/sig/definition.rbs +1 -0
- data/sig/definition_builder.rbs +1 -1
- data/sig/environment/class_entry.rbs +50 -0
- data/sig/environment/module_entry.rbs +50 -0
- data/sig/environment.rbs +28 -133
- data/sig/errors.rbs +13 -6
- data/sig/inline_parser/comment_association.rbs +71 -0
- data/sig/inline_parser.rbs +87 -0
- data/sig/location.rbs +32 -7
- data/sig/manifest.yaml +1 -0
- data/sig/method_builder.rbs +7 -4
- data/sig/parser.rbs +16 -20
- data/sig/resolver/type_name_resolver.rbs +7 -38
- data/sig/source.rbs +48 -0
- data/sig/types.rbs +1 -4
- data/src/ast.c +290 -201
- data/src/lexer.c +2813 -2902
- data/src/lexer.re +4 -0
- data/src/lexstate.c +155 -169
- data/src/location.c +40 -40
- data/src/parser.c +2665 -2433
- data/src/string.c +48 -0
- data/src/util/rbs_allocator.c +77 -80
- data/src/util/rbs_assert.c +10 -10
- data/src/util/rbs_buffer.c +2 -2
- data/src/util/rbs_constant_pool.c +15 -13
- data/src/util/rbs_encoding.c +4062 -20097
- data/src/util/rbs_unescape.c +48 -85
- data/stdlib/bigdecimal/0/big_decimal.rbs +82 -100
- data/stdlib/bigdecimal-math/0/big_math.rbs +8 -169
- data/stdlib/cgi/0/core.rbs +396 -2
- data/stdlib/cgi/0/manifest.yaml +0 -1
- data/stdlib/coverage/0/coverage.rbs +1 -3
- data/stdlib/date/0/date.rbs +59 -67
- data/stdlib/date/0/date_time.rbs +1 -1
- data/stdlib/delegate/0/delegator.rbs +7 -10
- data/stdlib/erb/0/erb.rbs +347 -737
- data/stdlib/fileutils/0/fileutils.rbs +13 -18
- data/stdlib/forwardable/0/forwardable.rbs +0 -3
- data/stdlib/json/0/json.rbs +48 -68
- data/stdlib/net-http/0/net-http.rbs +0 -3
- data/stdlib/objspace/0/objspace.rbs +4 -9
- data/stdlib/open-uri/0/open-uri.rbs +0 -40
- data/stdlib/openssl/0/openssl.rbs +228 -331
- data/stdlib/optparse/0/optparse.rbs +3 -3
- data/{core → stdlib/pathname/0}/pathname.rbs +355 -255
- data/stdlib/psych/0/psych.rbs +3 -3
- data/stdlib/rdoc/0/rdoc.rbs +1 -1
- data/stdlib/resolv/0/resolv.rbs +68 -25
- data/stdlib/ripper/0/ripper.rbs +2 -5
- data/stdlib/singleton/0/singleton.rbs +0 -3
- data/stdlib/socket/0/socket.rbs +1 -13
- data/stdlib/socket/0/tcp_socket.rbs +2 -10
- data/stdlib/stringio/0/stringio.rbs +85 -1176
- data/stdlib/strscan/0/string_scanner.rbs +31 -31
- data/stdlib/tempfile/0/tempfile.rbs +3 -3
- data/stdlib/time/0/time.rbs +1 -1
- data/stdlib/timeout/0/timeout.rbs +7 -63
- data/stdlib/tsort/0/cyclic.rbs +0 -3
- data/stdlib/uri/0/common.rbs +2 -11
- data/stdlib/uri/0/file.rbs +1 -1
- data/stdlib/uri/0/generic.rbs +16 -17
- data/stdlib/uri/0/rfc2396_parser.rbs +7 -6
- data/stdlib/zlib/0/zstream.rbs +0 -1
- metadata +40 -12
- data/.clang-format +0 -74
- data/.clangd +0 -2
- data/.github/workflows/c-check.yml +0 -54
- data/core/ruby.rbs +0 -53
- data/docs/aliases.md +0 -79
- data/docs/encoding.md +0 -56
- data/ext/rbs_extension/compat.h +0 -10
- data/stdlib/cgi-escape/0/escape.rbs +0 -153
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d0f208999624a32e97044b8427ec19fa233e21a530a6383efe4ea5b9333ab1ce
|
|
4
|
+
data.tar.gz: d03954e5a4fa29a428085183a90a86b481849b0994e0d454cccca395412a31f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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.
|
|
19
|
+
ruby-version: "3.4.1"
|
|
20
20
|
bundler: none
|
|
21
21
|
- name: Install dependencies
|
|
22
22
|
run: |
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -13,24 +13,26 @@ jobs:
|
|
|
13
13
|
strategy:
|
|
14
14
|
fail-fast: false
|
|
15
15
|
matrix:
|
|
16
|
-
ruby: ['3.
|
|
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
|
|
23
|
+
- ruby: "3.4"
|
|
24
24
|
job: stdlib_test
|
|
25
|
-
- ruby: "4
|
|
25
|
+
- ruby: "3.4"
|
|
26
26
|
job: test
|
|
27
27
|
rubyopt: "--enable-frozen-string-literal"
|
|
28
|
-
- ruby: "4
|
|
28
|
+
- ruby: "3.4"
|
|
29
29
|
job: stdlib_test
|
|
30
30
|
rubyopt: "--enable-frozen-string-literal"
|
|
31
|
-
- ruby: "4
|
|
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
|
|
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@
|
|
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.
|
|
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.
|
|
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
|
|
36
|
+
system "gem uninstall #{bundled_gems.join(" ")} --force", exception: true
|
|
37
37
|
'
|
|
38
38
|
- name: bundle install
|
|
39
39
|
run: |
|
data/.gitignore
CHANGED
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: "
|
|
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
|
-
|
|
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{
|
|
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/
|
|
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
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
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 "
|
|
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 "
|
|
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:
|
|
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
|