rbs 4.1.0.pre.2 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.dockerignore +37 -0
- data/.github/workflows/bundle-update.yml +1 -1
- data/.github/workflows/c-check.yml +11 -6
- data/.github/workflows/comments.yml +2 -2
- data/.github/workflows/dependabot.yml +1 -1
- data/.github/workflows/jruby.yml +15 -3
- data/.github/workflows/milestone.yml +9 -1
- data/.github/workflows/ruby.yml +4 -4
- data/.github/workflows/rust.yml +10 -8
- data/.github/workflows/truffleruby.yml +1 -1
- data/.github/workflows/typecheck.yml +2 -2
- data/.github/workflows/wasm.yml +4 -2
- data/.github/workflows/windows.yml +2 -2
- data/.gitignore +3 -2
- data/CHANGELOG.md +88 -0
- data/Dockerfile.jruby +53 -0
- data/Rakefile +16 -29
- data/Steepfile +2 -0
- data/core/array.rbs +228 -165
- data/core/float.rbs +0 -24
- data/core/match_data.rbs +1 -1
- data/core/pathname.rbs +0 -10
- data/core/ractor.rbs +0 -10
- data/core/rubygems/errors.rbs +4 -1
- data/core/rubygems/requirement.rbs +0 -10
- data/core/rubygems/rubygems.rbs +4 -1
- data/core/rubygems/specification.rbs +8 -0
- data/core/rubygems/version.rbs +0 -160
- data/core/thread.rbs +3 -8
- data/docs/CONTRIBUTING.md +1 -1
- data/docs/release.md +69 -0
- data/ext/rbs_extension/ast_translation.c +2 -2
- data/ext/rbs_extension/legacy_location.c +11 -6
- data/lib/rbs/parser_aux.rb +4 -2
- data/lib/rbs/prototype/rbi.rb +193 -25
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/wasm/runtime.rb +7 -28
- data/lib/rbs_jars.rb +39 -0
- data/lib/rdoc_plugin/parser.rb +5 -0
- data/rbs.gemspec +16 -3
- data/sig/prototype/rbi.rbs +33 -4
- data/src/lexer.c +97 -93
- data/src/lexer.re +1 -1
- data/src/lexstate.c +6 -2
- data/src/util/rbs_allocator.c +13 -4
- data/stdlib/delegate/0/delegator.rbs +2 -1
- data/stdlib/digest/0/digest.rbs +10 -4
- data/stdlib/erb/0/erb.rbs +1 -1
- data/stdlib/ipaddr/0/ipaddr.rbs +0 -5
- data/stdlib/monitor/0/monitor.rbs +2 -2
- data/stdlib/openssl/0/openssl.rbs +39 -33
- data/stdlib/tempfile/0/manifest.yaml +3 -0
- data/stdlib/timeout/0/timeout.rbs +0 -5
- data/stdlib/uri/0/generic.rbs +0 -5
- data/stdlib/zlib/0/zstream.rbs +0 -1
- data/wasm/README.md +4 -3
- data/wasm/rbs_wasm.c +12 -0
- metadata +6 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0cb4ca04de969abdc9d7f58e67fb98a0ce0d39e6669dab1be23241ba08a1b883
|
|
4
|
+
data.tar.gz: c758f606ee5737b64c45fd4da9c99f6522f1a62a0b8a37b4023d37fcb69b6d59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 26dbbd5af3941363c80a282d63dfda59d0aba521bea2c75e45c3dd58336a18920d859ef426b0c8bab67535be7e3651f8f2f83a78ed068477dd5ccf8adb09df4c
|
|
7
|
+
data.tar.gz: 0a5c85aa87e7ddb72519953952bb0bec098c8322cd379fb0e5e8dfb6ac0b1a8f4df70ee225cb3361b719d0b506b5d9eff0c43db08ce235d7ac233adb320d9d8a
|
data/.dockerignore
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Keep the build context small. .git is intentionally NOT ignored: rbs.gemspec
|
|
2
|
+
# builds its file list with `git ls-files`.
|
|
3
|
+
#
|
|
4
|
+
# Safe to ignore here: untracked/generated paths, and tracked paths the gemspec
|
|
5
|
+
# already rejects (so `gem build` does not expect them on disk). Do NOT ignore a
|
|
6
|
+
# tracked path the gemspec ships — `gem build` would fail with "... are not
|
|
7
|
+
# files". .vscode/ and benchmark/ are tracked but rejected by the gemspec.
|
|
8
|
+
.vscode/
|
|
9
|
+
benchmark/
|
|
10
|
+
|
|
11
|
+
# Editor / tooling / worktree copies (untracked; each is a full repo clone)
|
|
12
|
+
.claude/
|
|
13
|
+
trees/
|
|
14
|
+
.devcontainer/
|
|
15
|
+
.idea/
|
|
16
|
+
.ruby-lsp/
|
|
17
|
+
.yardoc/
|
|
18
|
+
doc/
|
|
19
|
+
datasets/
|
|
20
|
+
tmp/
|
|
21
|
+
|
|
22
|
+
# Build artifact — rebuilt inside the image by `rake wasm:jruby_setup`
|
|
23
|
+
lib/rbs/wasm/*.wasm
|
|
24
|
+
*.gem
|
|
25
|
+
ext/**/*.o
|
|
26
|
+
ext/**/*.so
|
|
27
|
+
ext/**/*.bundle
|
|
28
|
+
*.log
|
|
29
|
+
|
|
30
|
+
# Local scratch / experiment files
|
|
31
|
+
flamegraph.html
|
|
32
|
+
gc.html
|
|
33
|
+
foo.rbs
|
|
34
|
+
sorted.json
|
|
35
|
+
string.json
|
|
36
|
+
Gemfile-*
|
|
37
|
+
gemfiles/
|
|
@@ -14,7 +14,7 @@ jobs:
|
|
|
14
14
|
format-check:
|
|
15
15
|
runs-on: ubuntu-latest
|
|
16
16
|
steps:
|
|
17
|
-
- uses: actions/checkout@
|
|
17
|
+
- uses: actions/checkout@v7
|
|
18
18
|
- uses: ruby/setup-ruby@v1
|
|
19
19
|
with:
|
|
20
20
|
ruby-version: "4.0"
|
|
@@ -27,8 +27,13 @@ jobs:
|
|
|
27
27
|
sudo apt-get install -y libdb-dev curl autoconf automake m4 libtool
|
|
28
28
|
- name: Install clang-format from LLVM
|
|
29
29
|
run: |
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
# The codename must match the `runs-on` image: `ubuntu-latest` is 24.04 (noble).
|
|
31
|
+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key \
|
|
32
|
+
| sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
|
|
33
|
+
# Written directly rather than through `apt-add-repository`, which cannot
|
|
34
|
+
# parse `[signed-by=...]` inside a one-line `deb` shortcut.
|
|
35
|
+
echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main" \
|
|
36
|
+
| sudo tee /etc/apt/sources.list.d/llvm.list
|
|
32
37
|
sudo apt-get update
|
|
33
38
|
sudo apt-get install -y clang-format-20
|
|
34
39
|
sudo ln -sf /usr/bin/clang-format-20 /usr/local/bin/clang-format
|
|
@@ -38,9 +43,9 @@ jobs:
|
|
|
38
43
|
- name: Install Re2c
|
|
39
44
|
run: |
|
|
40
45
|
cd /tmp
|
|
41
|
-
curl -L https://github.com/skvadrik/re2c/archive/refs/tags/4.
|
|
42
|
-
tar xf re2c-4.
|
|
43
|
-
cd re2c-4.
|
|
46
|
+
curl -L https://github.com/skvadrik/re2c/archive/refs/tags/4.5.1.tar.gz > re2c-4.5.1.tar.gz
|
|
47
|
+
tar xf re2c-4.5.1.tar.gz
|
|
48
|
+
cd re2c-4.5.1
|
|
44
49
|
cmake --preset=linux-gcc-release-ootree-skeleton-fast
|
|
45
50
|
cmake --build --preset=linux-gcc-release-ootree-skeleton-fast --parallel="$(nproc)"
|
|
46
51
|
sudo ln -sf "$(pwd)"/.build/linux-gcc-release-ootree-skeleton-fast/re2c /usr/local/bin/re2c
|
|
@@ -13,10 +13,10 @@ jobs:
|
|
|
13
13
|
# env:
|
|
14
14
|
# RUBY_COMMIT: v4.0.0-preview2
|
|
15
15
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
16
|
+
- uses: actions/checkout@v7
|
|
17
17
|
- uses: ruby/setup-ruby@v1
|
|
18
18
|
with:
|
|
19
|
-
ruby-version: "4.0.
|
|
19
|
+
ruby-version: "4.0.6"
|
|
20
20
|
bundler: none
|
|
21
21
|
- name: Install dependencies
|
|
22
22
|
run: |
|
|
@@ -17,7 +17,7 @@ jobs:
|
|
|
17
17
|
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
|
|
18
18
|
id: metadata
|
|
19
19
|
- name: Checkout repository
|
|
20
|
-
uses: actions/checkout@
|
|
20
|
+
uses: actions/checkout@v7
|
|
21
21
|
with:
|
|
22
22
|
fetch-depth: 0
|
|
23
23
|
- name: Abort if blocker files are changed
|
data/.github/workflows/jruby.yml
CHANGED
|
@@ -17,6 +17,8 @@ on:
|
|
|
17
17
|
- "test/**"
|
|
18
18
|
- "Rakefile"
|
|
19
19
|
- "rbs.gemspec"
|
|
20
|
+
# `merge_group` has no `paths` filter, so this runs on every queue entry.
|
|
21
|
+
merge_group: {}
|
|
20
22
|
|
|
21
23
|
permissions:
|
|
22
24
|
contents: read
|
|
@@ -31,7 +33,7 @@ jobs:
|
|
|
31
33
|
name: jruby
|
|
32
34
|
runs-on: ubuntu-latest
|
|
33
35
|
steps:
|
|
34
|
-
- uses: actions/checkout@
|
|
36
|
+
- uses: actions/checkout@v7
|
|
35
37
|
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
36
38
|
|
|
37
39
|
# Build the .wasm and fetch the Chicory jars with CRuby + the WASI SDK,
|
|
@@ -53,7 +55,7 @@ jobs:
|
|
|
53
55
|
mkdir -p "$HOME/wasi-sdk"
|
|
54
56
|
curl -sSL "$url" | tar xz --strip-components=1 -C "$HOME/wasi-sdk"
|
|
55
57
|
echo "WASI_SDK_PATH=$HOME/wasi-sdk" >> "$GITHUB_ENV"
|
|
56
|
-
- name:
|
|
58
|
+
- name: Build rbs_parser.wasm
|
|
57
59
|
run: bundle exec rake wasm:jruby_setup
|
|
58
60
|
|
|
59
61
|
- name: Set up JRuby
|
|
@@ -62,6 +64,16 @@ jobs:
|
|
|
62
64
|
ruby-version: jruby
|
|
63
65
|
bundler: none
|
|
64
66
|
- name: Install runtime and test gems
|
|
65
|
-
|
|
67
|
+
# rdoc 8.0.0 added a runtime dependency on rbs, which pulls the released
|
|
68
|
+
# C-extension rbs gem and fails to build on JRuby. Pin rdoc below 8 until
|
|
69
|
+
# a -java rbs gem is published.
|
|
70
|
+
run: |
|
|
71
|
+
gem install prism rake rake-compiler test-unit rspec minitest json-schema pry --no-document
|
|
72
|
+
gem install rdoc -v "< 8" --no-document
|
|
73
|
+
# jar-dependencies resolves through the JVM, so download the Chicory/ASM
|
|
74
|
+
# jars into ~/.m2 here on JRuby (jar-dependencies is not available in the
|
|
75
|
+
# CRuby step above).
|
|
76
|
+
- name: Download the Chicory and ASM jars
|
|
77
|
+
run: jruby -S rake wasm:install_jars
|
|
66
78
|
- name: Run the test suite on JRuby
|
|
67
79
|
run: jruby -S rake test
|
|
@@ -3,6 +3,7 @@ name: Check milestone
|
|
|
3
3
|
on:
|
|
4
4
|
pull_request:
|
|
5
5
|
types: [opened, edited, labeled, unlabeled, milestoned, demilestoned, synchronize]
|
|
6
|
+
merge_group: {}
|
|
6
7
|
|
|
7
8
|
permissions:
|
|
8
9
|
contents: read
|
|
@@ -12,10 +13,16 @@ jobs:
|
|
|
12
13
|
runs-on: ubuntu-latest
|
|
13
14
|
|
|
14
15
|
steps:
|
|
15
|
-
|
|
16
|
+
# The milestone is a property of the pull request, so there is nothing to
|
|
17
|
+
# check once it enters the merge queue. This job still has to run there
|
|
18
|
+
# because `check` is a required status check -- it just reports success
|
|
19
|
+
# without doing anything.
|
|
20
|
+
- uses: actions/checkout@v7
|
|
21
|
+
if: github.event_name == 'pull_request'
|
|
16
22
|
|
|
17
23
|
- name: Extract RBS::Version
|
|
18
24
|
id: version
|
|
25
|
+
if: github.event_name == 'pull_request'
|
|
19
26
|
run: |
|
|
20
27
|
# Extract version string from lib/rbs/version.rb
|
|
21
28
|
version=$(ruby -e 'load "lib/rbs/version.rb"; print RBS::VERSION')
|
|
@@ -30,6 +37,7 @@ jobs:
|
|
|
30
37
|
echo "RBS::VERSION = $version (major=$major, minor=$minor, patch=$patch)"
|
|
31
38
|
|
|
32
39
|
- name: Check milestone
|
|
40
|
+
if: github.event_name == 'pull_request'
|
|
33
41
|
uses: actions/github-script@v9
|
|
34
42
|
with:
|
|
35
43
|
script: |
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
strategy:
|
|
17
17
|
fail-fast: false
|
|
18
18
|
matrix:
|
|
19
|
-
ruby: ['3.
|
|
19
|
+
ruby: ['3.3', '3.4', '4.0', head]
|
|
20
20
|
rubyopt: [""]
|
|
21
21
|
job:
|
|
22
22
|
- test
|
|
@@ -40,7 +40,7 @@ jobs:
|
|
|
40
40
|
env:
|
|
41
41
|
RANDOMIZE_STDLIB_TEST_ORDER: "true"
|
|
42
42
|
steps:
|
|
43
|
-
- uses: actions/checkout@
|
|
43
|
+
- uses: actions/checkout@v7
|
|
44
44
|
- uses: ruby/setup-ruby@v1
|
|
45
45
|
with:
|
|
46
46
|
ruby-version: ${{ matrix.ruby }}
|
|
@@ -90,7 +90,7 @@ jobs:
|
|
|
90
90
|
matrix:
|
|
91
91
|
ruby: ['4.0', head]
|
|
92
92
|
steps:
|
|
93
|
-
- uses: actions/checkout@
|
|
93
|
+
- uses: actions/checkout@v7
|
|
94
94
|
- name: Install dependencies
|
|
95
95
|
run: |
|
|
96
96
|
brew install ruby-build
|
|
@@ -127,7 +127,7 @@ jobs:
|
|
|
127
127
|
matrix:
|
|
128
128
|
ruby: ['4.0', head]
|
|
129
129
|
steps:
|
|
130
|
-
- uses: actions/checkout@
|
|
130
|
+
- uses: actions/checkout@v7
|
|
131
131
|
- name: Install dependencies
|
|
132
132
|
run: |
|
|
133
133
|
brew install ruby-build
|
data/.github/workflows/rust.yml
CHANGED
|
@@ -8,6 +8,8 @@ on:
|
|
|
8
8
|
paths:
|
|
9
9
|
- ".github/workflows/rust.yml"
|
|
10
10
|
- "rust/**"
|
|
11
|
+
# `merge_group` has no `paths` filter, so this runs on every queue entry.
|
|
12
|
+
merge_group: {}
|
|
11
13
|
|
|
12
14
|
env:
|
|
13
15
|
RUSTFLAGS: "-D warnings"
|
|
@@ -24,7 +26,7 @@ jobs:
|
|
|
24
26
|
matrix:
|
|
25
27
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
26
28
|
steps:
|
|
27
|
-
- uses: actions/checkout@
|
|
29
|
+
- uses: actions/checkout@v7
|
|
28
30
|
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
29
31
|
- name: Set up Ruby
|
|
30
32
|
uses: ruby/setup-ruby@v1
|
|
@@ -43,7 +45,7 @@ jobs:
|
|
|
43
45
|
run: |
|
|
44
46
|
rustup update --no-self-update stable
|
|
45
47
|
rustup default stable
|
|
46
|
-
- uses: actions/cache@
|
|
48
|
+
- uses: actions/cache@v6
|
|
47
49
|
with:
|
|
48
50
|
path: |
|
|
49
51
|
~/.cargo/registry
|
|
@@ -62,7 +64,7 @@ jobs:
|
|
|
62
64
|
runs-on: ubuntu-latest
|
|
63
65
|
continue-on-error: true
|
|
64
66
|
steps:
|
|
65
|
-
- uses: actions/checkout@
|
|
67
|
+
- uses: actions/checkout@v7
|
|
66
68
|
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
67
69
|
- name: Set up git identity
|
|
68
70
|
run: |
|
|
@@ -85,7 +87,7 @@ jobs:
|
|
|
85
87
|
run: |
|
|
86
88
|
rustup update --no-self-update stable
|
|
87
89
|
rustup default stable
|
|
88
|
-
- uses: actions/cache@
|
|
90
|
+
- uses: actions/cache@v6
|
|
89
91
|
with:
|
|
90
92
|
path: |
|
|
91
93
|
~/.cargo/registry
|
|
@@ -104,7 +106,7 @@ jobs:
|
|
|
104
106
|
runs-on: ubuntu-latest
|
|
105
107
|
continue-on-error: true
|
|
106
108
|
steps:
|
|
107
|
-
- uses: actions/checkout@
|
|
109
|
+
- uses: actions/checkout@v7
|
|
108
110
|
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
109
111
|
- name: Set up git identity
|
|
110
112
|
run: |
|
|
@@ -127,7 +129,7 @@ jobs:
|
|
|
127
129
|
run: |
|
|
128
130
|
rustup update --no-self-update stable
|
|
129
131
|
rustup default stable
|
|
130
|
-
- uses: actions/cache@
|
|
132
|
+
- uses: actions/cache@v6
|
|
131
133
|
with:
|
|
132
134
|
path: |
|
|
133
135
|
~/.cargo/registry
|
|
@@ -145,7 +147,7 @@ jobs:
|
|
|
145
147
|
name: cargo:lint
|
|
146
148
|
runs-on: ubuntu-latest
|
|
147
149
|
steps:
|
|
148
|
-
- uses: actions/checkout@
|
|
150
|
+
- uses: actions/checkout@v7
|
|
149
151
|
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
150
152
|
- name: Set up Ruby
|
|
151
153
|
uses: ruby/setup-ruby@v1
|
|
@@ -165,7 +167,7 @@ jobs:
|
|
|
165
167
|
rustup update --no-self-update stable
|
|
166
168
|
rustup default stable
|
|
167
169
|
rustup component add --toolchain stable clippy rustfmt
|
|
168
|
-
- uses: actions/cache@
|
|
170
|
+
- uses: actions/cache@v6
|
|
169
171
|
with:
|
|
170
172
|
path: |
|
|
171
173
|
~/.cargo/registry
|
|
@@ -16,10 +16,10 @@ jobs:
|
|
|
16
16
|
strategy:
|
|
17
17
|
fail-fast: false
|
|
18
18
|
steps:
|
|
19
|
-
- uses: actions/checkout@
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
20
|
- uses: ruby/setup-ruby@v1
|
|
21
21
|
with:
|
|
22
|
-
ruby-version: "
|
|
22
|
+
ruby-version: "4.0"
|
|
23
23
|
bundler: none
|
|
24
24
|
- name: Set working directory as safe
|
|
25
25
|
run: git config --global --add safe.directory $(pwd)
|
data/.github/workflows/wasm.yml
CHANGED
|
@@ -11,6 +11,8 @@ on:
|
|
|
11
11
|
- "include/**"
|
|
12
12
|
- "src/**"
|
|
13
13
|
- "wasm/**"
|
|
14
|
+
# `merge_group` has no `paths` filter, so this runs on every queue entry.
|
|
15
|
+
merge_group: {}
|
|
14
16
|
|
|
15
17
|
permissions:
|
|
16
18
|
contents: read
|
|
@@ -19,14 +21,14 @@ env:
|
|
|
19
21
|
# Pinned so the smoke test is reproducible. Bump together when upgrading.
|
|
20
22
|
WASI_SDK_VERSION: "33"
|
|
21
23
|
WASI_SDK_RELEASE: "33.0"
|
|
22
|
-
WASMTIME_VERSION: "
|
|
24
|
+
WASMTIME_VERSION: "v47.0.2"
|
|
23
25
|
|
|
24
26
|
jobs:
|
|
25
27
|
build:
|
|
26
28
|
name: wasm:check
|
|
27
29
|
runs-on: ubuntu-latest
|
|
28
30
|
steps:
|
|
29
|
-
- uses: actions/checkout@
|
|
31
|
+
- uses: actions/checkout@v7
|
|
30
32
|
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
31
33
|
- name: Set up Ruby
|
|
32
34
|
uses: ruby/setup-ruby@v1
|
data/.gitignore
CHANGED
|
@@ -33,6 +33,7 @@ rust/ruby-rbs/vendor/rbs/
|
|
|
33
33
|
# Compiled WebAssembly module (built by rake wasm:build)
|
|
34
34
|
wasm/*.wasm
|
|
35
35
|
|
|
36
|
-
# JRuby runtime
|
|
36
|
+
# JRuby runtime artifact (built by rake wasm:jruby_setup, bundled in the -java
|
|
37
|
+
# gem). The require_jar file lib/rbs_jars.rb is committed; the Chicory/ASM jars
|
|
38
|
+
# themselves live in ~/.m2 (jar-dependencies), not here.
|
|
37
39
|
lib/rbs/wasm/*.wasm
|
|
38
|
-
lib/rbs/wasm/jars/
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,93 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 4.1.0 (2026-07-27)
|
|
4
|
+
|
|
5
|
+
RBS 4.1 ships with JRuby support. The RBS parser is written in plain C without depending on the Ruby C API, so it is compiled to WebAssembly and runs on a Wasm runtime, with the parsed AST serialized in a binary format and decoded into RBS objects. The full test suite runs on JRuby in CI.
|
|
6
|
+
|
|
7
|
+
The inline RBS syntax gets three new features: singleton method definitions (`def self.`), the `module-self` constraint, and instance variable annotations in `module` declarations. Note that RBS inline is still experimental and may change in future releases.
|
|
8
|
+
|
|
9
|
+
This release also introduces `RBS::Rewriter`, an API to edit RBS source text while preserving the surrounding content, which `rbs annotate` is now built on. Parsing performance is improved by interning type names in a shared trie and reducing allocations per node.
|
|
10
|
+
|
|
11
|
+
`RBS::Prototype::Runtime`, the RDoc plugin parser, and the top-level `float` type alias are deprecated in this release.
|
|
12
|
+
|
|
13
|
+
### Signature updates
|
|
14
|
+
|
|
15
|
+
**Updated classes/modules/methods:** `ARGF`, `Array`, `CSV`, `Class`, `Delegator`, `Digest`, `ERB`, `Enumerable`, `Enumerator`, `Enumerator::Product`, `Etc`, `File`, `File::Constants`, `File::Stat`, `FileUtils`, `Float`, `Gem`, `Hash`, `IO`, `IPAddr`, `Integer`, `JSON`, `Kernel`, `MatchData`, `Module`, `Monitor`, `Numeric`, `ObjectSpace::WeakKeyMap`, `OpenSSL`, `Pathname`, `RBS::Ops`, `Ractor`, `Range`, `Resolv`, `RubyVM::InstructionSequence`, `Set`, `Shellwords`, `String`, `StringIO`, `StringScanner`, `Struct`, `Tempfile`, `Thread`, `Timeout`, `TSort`, `URI::Generic`, `Zlib::GzipReader`, `Zlib::ZStream`
|
|
16
|
+
|
|
17
|
+
* Remove stale Float constants and add a constant drift test ([#2994](https://github.com/ruby/rbs/pull/2994))
|
|
18
|
+
* Update RDoc comments with Ruby 4.0.6 ([#3035](https://github.com/ruby/rbs/pull/3035))
|
|
19
|
+
* Add a dependency on tempfile. ([#3025](https://github.com/ruby/rbs/pull/3025))
|
|
20
|
+
* Support `%a{implicitly-returns-nil}` on `MatchData#[]` ([#2990](https://github.com/ruby/rbs/pull/2990))
|
|
21
|
+
* Update `Array` ([#2987](https://github.com/ruby/rbs/pull/2987))
|
|
22
|
+
* Allow nil output buffers for reader methods ([#3002](https://github.com/ruby/rbs/pull/3002))
|
|
23
|
+
* Add stdlib signature tests for #2967 ([#2989](https://github.com/ruby/rbs/pull/2989))
|
|
24
|
+
* Update `Integer`, phase 1 ([#2995](https://github.com/ruby/rbs/pull/2995))
|
|
25
|
+
* Add RBS::Ops ([#2934](https://github.com/ruby/rbs/pull/2934))
|
|
26
|
+
* Update Module ([#2933](https://github.com/ruby/rbs/pull/2933))
|
|
27
|
+
* Correct core/stdlib signatures to match Ruby 4.0 ([#2967](https://github.com/ruby/rbs/pull/2967))
|
|
28
|
+
* Revert Digest::Class method changes ([#2980](https://github.com/ruby/rbs/pull/2980))
|
|
29
|
+
* Add stdlib tests for updated StringScanner signatures ([#2968](https://github.com/ruby/rbs/pull/2968))
|
|
30
|
+
* Update `StringScanner` signatures to match strscan 3.1.6 ([#2959](https://github.com/ruby/rbs/pull/2959))
|
|
31
|
+
* Remove StringScanner methods absent from the latest Ruby release ([#2961](https://github.com/ruby/rbs/pull/2961))
|
|
32
|
+
* Fix `Resolv#initialize` signature: array of resolvers + `use_ipv6:` ([#2960](https://github.com/ruby/rbs/pull/2960))
|
|
33
|
+
* [Hash] Update Hash's signatures and tests to be correct ([#2694](https://github.com/ruby/rbs/pull/2694))
|
|
34
|
+
* update rbs signatures to be more consistent with generics ([#2867](https://github.com/ruby/rbs/pull/2867))
|
|
35
|
+
* Use top-level `path` in fileutils.rbs to suppress deprecation warning ([#2949](https://github.com/ruby/rbs/pull/2949))
|
|
36
|
+
* Update File::Constants and File::Stat ([#2942](https://github.com/ruby/rbs/pull/2942))
|
|
37
|
+
* Add signature for `RubyVM::InstructionSequence.of` ([#2916](https://github.com/ruby/rbs/pull/2916))
|
|
38
|
+
* fix OpenSSL#session_new_cb signature ([#2924](https://github.com/ruby/rbs/pull/2924))
|
|
39
|
+
* [Class] update class.rbs ([#2898](https://github.com/ruby/rbs/pull/2898))
|
|
40
|
+
* Deprecate top-level float ([#2695](https://github.com/ruby/rbs/pull/2695))
|
|
41
|
+
* [Kernel] Updated querying methods ([#2685](https://github.com/ruby/rbs/pull/2685))
|
|
42
|
+
|
|
43
|
+
### Library changes
|
|
44
|
+
|
|
45
|
+
* Convert character offset to byte offset in parse_inline_*_annotation ([#2945](https://github.com/ruby/rbs/pull/2945))
|
|
46
|
+
* Guard against underflow when sysconf(_SC_PAGESIZE) returns 0 ([#3031](https://github.com/ruby/rbs/pull/3031))
|
|
47
|
+
* Report invalid UTF-8 byte in a comment as a parsing error ([#2983](https://github.com/ruby/rbs/pull/2983))
|
|
48
|
+
* Fetch Chicory/ASM jars from Maven instead of bundling in gem ([#3019](https://github.com/ruby/rbs/pull/3019))
|
|
49
|
+
* Add write barrier protection to RBS Location objects ([#3022](https://github.com/ruby/rbs/pull/3022))
|
|
50
|
+
* Rename parameter in rbs_intern_type_name for clarity ([#3023](https://github.com/ruby/rbs/pull/3023))
|
|
51
|
+
* Deprecate RDoc plugin parser ([#3016](https://github.com/ruby/rbs/pull/3016))
|
|
52
|
+
* Run the test suite on JRuby (JRuby support, step 4) ([#3008](https://github.com/ruby/rbs/pull/3008))
|
|
53
|
+
* Run the RBS parser on JRuby via WebAssembly (JRuby support, step 3) ([#3000](https://github.com/ruby/rbs/pull/3000))
|
|
54
|
+
* Add binary serialization of the parsed AST (JRuby support, step 2) ([#2999](https://github.com/ruby/rbs/pull/2999))
|
|
55
|
+
* Build the RBS parser as a WebAssembly module (JRuby support, step 1) ([#2998](https://github.com/ruby/rbs/pull/2998))
|
|
56
|
+
* Reject reversed position ranges in parser/lexer entrypoints ([#2974](https://github.com/ruby/rbs/pull/2974))
|
|
57
|
+
* Fix lexer infinite loop / abort on invalid UTF-8 byte ([#2973](https://github.com/ruby/rbs/pull/2973))
|
|
58
|
+
* Flyweight TypeName / Namespace cached in a shared trie ([#2957](https://github.com/ruby/rbs/pull/2957))
|
|
59
|
+
* Reduce Hash allocation per `Node` creation ([#2946](https://github.com/ruby/rbs/pull/2946))
|
|
60
|
+
* Tidy `ast_translation.c` ([#2947](https://github.com/ruby/rbs/pull/2947))
|
|
61
|
+
* Auto-generate rbs_ast_ruby_annotations_t union from config.yml ([#2939](https://github.com/ruby/rbs/pull/2939))
|
|
62
|
+
* Speed up RBS::InlineParser on large sources with non-ASCII characters ([#2950](https://github.com/ruby/rbs/pull/2950))
|
|
63
|
+
* Support `def self.method_name` singleton method in inline parser ([#2935](https://github.com/ruby/rbs/pull/2935))
|
|
64
|
+
* This is not prism ([#2951](https://github.com/ruby/rbs/pull/2951))
|
|
65
|
+
* Add RBS::Rewriter and use it in rbs annotate ([#2927](https://github.com/ruby/rbs/pull/2927))
|
|
66
|
+
* Add nullability annotations to AST pointer types ([#2922](https://github.com/ruby/rbs/pull/2922))
|
|
67
|
+
* Support `module-self` inline annotation ([#2921](https://github.com/ruby/rbs/pull/2921))
|
|
68
|
+
* Inline instance variable annotation in module declaration ([#2919](https://github.com/ruby/rbs/pull/2919))
|
|
69
|
+
|
|
70
|
+
#### rbs prototype
|
|
71
|
+
|
|
72
|
+
* Fix nested declarations in rbs prototype rbi ([#3029](https://github.com/ruby/rbs/pull/3029))
|
|
73
|
+
* Deprecate prototype runtime ([#2956](https://github.com/ruby/rbs/pull/2956))
|
|
74
|
+
|
|
75
|
+
#### rbs collection
|
|
76
|
+
|
|
77
|
+
* Clean up partial clone before falling back to full clone ([#2978](https://github.com/ruby/rbs/pull/2978))
|
|
78
|
+
* Suppress spurious warning for non-gem stdlib libraries ([#2929](https://github.com/ruby/rbs/pull/2929))
|
|
79
|
+
|
|
80
|
+
### Miscellaneous
|
|
81
|
+
|
|
82
|
+
* Fix Lint/DuplicateMethods in StringIO_test.rb ([#3010](https://github.com/ruby/rbs/pull/3010))
|
|
83
|
+
* Compressed files must be opened in binary mode ([#2981](https://github.com/ruby/rbs/pull/2981))
|
|
84
|
+
* Fix flaky DirSingletonTest GC failures in test_fchdir and test_for_fd ([#3004](https://github.com/ruby/rbs/pull/3004))
|
|
85
|
+
* Add TruffleRuby CI job ([#2996](https://github.com/ruby/rbs/pull/2996))
|
|
86
|
+
* Update the target Ruby version notes to the latest release ([#2962](https://github.com/ruby/rbs/pull/2962))
|
|
87
|
+
* Update docs/inline.md to match current inline parser behavior ([#2953](https://github.com/ruby/rbs/pull/2953))
|
|
88
|
+
* ci: skip Gemfile.lock BUNDLED WITH on ruby-head ([#2952](https://github.com/ruby/rbs/pull/2952))
|
|
89
|
+
* Remove `logger` from sig dependencies ([#2904](https://github.com/ruby/rbs/pull/2904))
|
|
90
|
+
|
|
3
91
|
## 4.0.2 (2026-03-25)
|
|
4
92
|
|
|
5
93
|
### Library changes
|
data/Dockerfile.jruby
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# JRuby verification image for RBS.
|
|
2
|
+
#
|
|
3
|
+
# RBS can't load its MRI C extension on JRuby, so it parses through a
|
|
4
|
+
# WebAssembly build of the parser (see lib/rbs/wasm and docs/wasm_serialization.md).
|
|
5
|
+
# This single-stage image installs the WASI SDK, compiles rbs_parser.wasm and
|
|
6
|
+
# downloads the Chicory/ASM jars into ~/.m2 (via jar-dependencies), then runs the
|
|
7
|
+
# test suite on JRuby. It mirrors .github/workflows/jruby.yml but is self-contained.
|
|
8
|
+
#
|
|
9
|
+
# docker build -f Dockerfile.jruby -t rbs-jruby .
|
|
10
|
+
# docker run --rm rbs-jruby # run the test suite
|
|
11
|
+
# docker run --rm -e RBS_PLATFORM=java rbs-jruby \
|
|
12
|
+
# gem build rbs.gemspec # build the -java gem
|
|
13
|
+
#
|
|
14
|
+
# Bundler is intentionally not used: the development Gemfile pulls in CRuby-only
|
|
15
|
+
# C extensions (bigdecimal, stackprof, ...) that cannot build on JRuby. The few
|
|
16
|
+
# gems the suite needs are installed directly, exactly as the CI does.
|
|
17
|
+
|
|
18
|
+
FROM jruby:10.1.1.0-jdk21
|
|
19
|
+
|
|
20
|
+
# Keep in sync with .github/workflows/wasm.yml and .github/workflows/jruby.yml.
|
|
21
|
+
ARG WASI_SDK_VERSION=33
|
|
22
|
+
ARG WASI_SDK_RELEASE=33.0
|
|
23
|
+
|
|
24
|
+
# build-essential supplies cc/make: on JRuby the prism gem builds libprism.so
|
|
25
|
+
# (loaded via FFI) instead of an MRI C extension, so it needs a C toolchain.
|
|
26
|
+
RUN apt-get update \
|
|
27
|
+
&& apt-get install -y --no-install-recommends git curl ca-certificates build-essential \
|
|
28
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
29
|
+
|
|
30
|
+
# The WASI SDK provides clang, the wasi-libc sysroot and the wasm32 compiler-rt
|
|
31
|
+
# builtins that `rake wasm:build` needs to compile src/**/*.c to WebAssembly.
|
|
32
|
+
RUN set -eux; \
|
|
33
|
+
case "$(uname -m)" in \
|
|
34
|
+
x86_64 | amd64) wasi_arch=x86_64 ;; \
|
|
35
|
+
aarch64 | arm64) wasi_arch=arm64 ;; \
|
|
36
|
+
*) echo "unsupported arch: $(uname -m)" >&2; exit 1 ;; \
|
|
37
|
+
esac; \
|
|
38
|
+
mkdir -p /opt/wasi-sdk; \
|
|
39
|
+
curl -fsSL "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_RELEASE}-${wasi_arch}-linux.tar.gz" \
|
|
40
|
+
| tar xz --strip-components=1 -C /opt/wasi-sdk
|
|
41
|
+
ENV WASI_SDK_PATH=/opt/wasi-sdk
|
|
42
|
+
|
|
43
|
+
# Runtime/test gems the suite needs on JRuby (same set as the jruby.yml CI).
|
|
44
|
+
RUN gem install prism rake rake-compiler test-unit rdoc rspec minitest json-schema pry --no-document
|
|
45
|
+
|
|
46
|
+
WORKDIR /rbs
|
|
47
|
+
COPY . .
|
|
48
|
+
|
|
49
|
+
# Compile rbs_parser.wasm (clang is a subprocess, so the build is engine
|
|
50
|
+
# independent) and download the Chicory + ASM jars into ~/.m2 via jar-dependencies.
|
|
51
|
+
RUN rake wasm:jruby_setup wasm:install_jars
|
|
52
|
+
|
|
53
|
+
CMD ["rake", "test"]
|
data/Rakefile
CHANGED
|
@@ -627,40 +627,27 @@ namespace :wasm do
|
|
|
627
627
|
end
|
|
628
628
|
end
|
|
629
629
|
|
|
630
|
-
# Where the runtime looks for the module
|
|
631
|
-
# RBS::WASM::Runtime). These are build artifacts, bundled into the JRuby gem.
|
|
630
|
+
# Where the runtime looks for the module by default (see RBS::WASM::Runtime).
|
|
632
631
|
JRUBY_WASM_DIR = File.expand_path("lib/rbs/wasm", __dir__)
|
|
633
|
-
CHICORY_VERSION = ENV.fetch("CHICORY_VERSION", "1.7.5")
|
|
634
|
-
# `compiler` is Chicory's AOT compiler (wasm -> JVM bytecode); the asm* jars
|
|
635
|
-
# are the ow2 ASM libraries it depends on. Keep ASM_VERSION in sync with what
|
|
636
|
-
# the pinned Chicory release declares.
|
|
637
|
-
CHICORY_JARS = %w[wasm runtime log wasi compiler].freeze
|
|
638
|
-
ASM_VERSION = ENV.fetch("ASM_VERSION", "9.9.1")
|
|
639
|
-
ASM_JARS = %w[asm asm-tree asm-util asm-commons asm-analysis].freeze
|
|
640
|
-
|
|
641
|
-
desc "Download the Chicory and ASM jars the JRuby runtime needs into lib/rbs/wasm/jars"
|
|
642
|
-
task :vendor_jars do
|
|
643
|
-
require "open-uri"
|
|
644
|
-
require "fileutils"
|
|
645
|
-
|
|
646
|
-
jars_dir = File.join(JRUBY_WASM_DIR, "jars")
|
|
647
|
-
FileUtils.mkdir_p(jars_dir)
|
|
648
|
-
|
|
649
|
-
downloads = CHICORY_JARS.map { |name| ["#{name}.jar", "https://repo1.maven.org/maven2/com/dylibso/chicory/#{name}/#{CHICORY_VERSION}/#{name}-#{CHICORY_VERSION}.jar"] }
|
|
650
|
-
downloads += ASM_JARS.map { |name| ["#{name}.jar", "https://repo1.maven.org/maven2/org/ow2/asm/#{name}/#{ASM_VERSION}/#{name}-#{ASM_VERSION}.jar"] }
|
|
651
|
-
|
|
652
|
-
downloads.each do |filename, url|
|
|
653
|
-
puts "Downloading #{url}"
|
|
654
|
-
URI.open(url) { |io| File.binwrite(File.join(jars_dir, filename), io.read) } # steep:ignore
|
|
655
|
-
end
|
|
656
632
|
|
|
657
|
-
|
|
633
|
+
desc "Download the Chicory/ASM jars into the local Maven repository (~/.m2). Run on JRuby."
|
|
634
|
+
task :install_jars do
|
|
635
|
+
# Resolves the `jar` requirements from rbs.gemspec via Maven and downloads
|
|
636
|
+
# them (and their transitive deps) into ~/.m2, the same way `gem install`
|
|
637
|
+
# does; the jars are not copied into the gem. The platform is forced to java
|
|
638
|
+
# because Jars::Installer skips non-java gems, and write_require_file is false
|
|
639
|
+
# because lib/rbs_jars.rb is hand-maintained (the generator mangles the
|
|
640
|
+
# `com.dylibso.chicory:runtime` artifact id).
|
|
641
|
+
require "jars/installer"
|
|
642
|
+
spec = Gem::Specification.load("rbs.gemspec")
|
|
643
|
+
spec.platform = "java"
|
|
644
|
+
Jars::Installer.new(spec).install_jars(write_require_file: false)
|
|
658
645
|
end
|
|
659
646
|
|
|
660
|
-
desc "
|
|
661
|
-
task :jruby_setup => [:build
|
|
647
|
+
desc "Build rbs_parser.wasm and copy it next to RBS::WASM::Runtime"
|
|
648
|
+
task :jruby_setup => [:build] do
|
|
662
649
|
cp WASM_OUTPUT, File.join(JRUBY_WASM_DIR, "rbs_parser.wasm")
|
|
663
|
-
puts "
|
|
650
|
+
puts "rbs_parser.wasm is ready under #{JRUBY_WASM_DIR}"
|
|
664
651
|
end
|
|
665
652
|
end
|
|
666
653
|
|
data/Steepfile
CHANGED
|
@@ -13,6 +13,8 @@ target :lib do
|
|
|
13
13
|
"lib/rbs/wasm/location.rb",
|
|
14
14
|
"lib/rbs/wasm/runtime.rb",
|
|
15
15
|
"lib/rbs/wasm/parser.rb",
|
|
16
|
+
# jar-dependencies require_jar calls for the JRuby runtime; not type-checked.
|
|
17
|
+
"lib/rbs_jars.rb",
|
|
16
18
|
)
|
|
17
19
|
|
|
18
20
|
library "pathname", "json", "logger", "monitor", "tsort", "uri", 'dbm', 'pstore', 'singleton', 'shellwords', 'fileutils', 'find', 'digest', 'prettyprint', 'yaml', "psych", "securerandom"
|