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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.dockerignore +37 -0
  3. data/.github/workflows/bundle-update.yml +1 -1
  4. data/.github/workflows/c-check.yml +11 -6
  5. data/.github/workflows/comments.yml +2 -2
  6. data/.github/workflows/dependabot.yml +1 -1
  7. data/.github/workflows/jruby.yml +15 -3
  8. data/.github/workflows/milestone.yml +9 -1
  9. data/.github/workflows/ruby.yml +4 -4
  10. data/.github/workflows/rust.yml +10 -8
  11. data/.github/workflows/truffleruby.yml +1 -1
  12. data/.github/workflows/typecheck.yml +2 -2
  13. data/.github/workflows/wasm.yml +4 -2
  14. data/.github/workflows/windows.yml +2 -2
  15. data/.gitignore +3 -2
  16. data/CHANGELOG.md +88 -0
  17. data/Dockerfile.jruby +53 -0
  18. data/Rakefile +16 -29
  19. data/Steepfile +2 -0
  20. data/core/array.rbs +228 -165
  21. data/core/float.rbs +0 -24
  22. data/core/match_data.rbs +1 -1
  23. data/core/pathname.rbs +0 -10
  24. data/core/ractor.rbs +0 -10
  25. data/core/rubygems/errors.rbs +4 -1
  26. data/core/rubygems/requirement.rbs +0 -10
  27. data/core/rubygems/rubygems.rbs +4 -1
  28. data/core/rubygems/specification.rbs +8 -0
  29. data/core/rubygems/version.rbs +0 -160
  30. data/core/thread.rbs +3 -8
  31. data/docs/CONTRIBUTING.md +1 -1
  32. data/docs/release.md +69 -0
  33. data/ext/rbs_extension/ast_translation.c +2 -2
  34. data/ext/rbs_extension/legacy_location.c +11 -6
  35. data/lib/rbs/parser_aux.rb +4 -2
  36. data/lib/rbs/prototype/rbi.rb +193 -25
  37. data/lib/rbs/version.rb +1 -1
  38. data/lib/rbs/wasm/runtime.rb +7 -28
  39. data/lib/rbs_jars.rb +39 -0
  40. data/lib/rdoc_plugin/parser.rb +5 -0
  41. data/rbs.gemspec +16 -3
  42. data/sig/prototype/rbi.rbs +33 -4
  43. data/src/lexer.c +97 -93
  44. data/src/lexer.re +1 -1
  45. data/src/lexstate.c +6 -2
  46. data/src/util/rbs_allocator.c +13 -4
  47. data/stdlib/delegate/0/delegator.rbs +2 -1
  48. data/stdlib/digest/0/digest.rbs +10 -4
  49. data/stdlib/erb/0/erb.rbs +1 -1
  50. data/stdlib/ipaddr/0/ipaddr.rbs +0 -5
  51. data/stdlib/monitor/0/monitor.rbs +2 -2
  52. data/stdlib/openssl/0/openssl.rbs +39 -33
  53. data/stdlib/tempfile/0/manifest.yaml +3 -0
  54. data/stdlib/timeout/0/timeout.rbs +0 -5
  55. data/stdlib/uri/0/generic.rbs +0 -5
  56. data/stdlib/zlib/0/zstream.rbs +0 -1
  57. data/wasm/README.md +4 -3
  58. data/wasm/rbs_wasm.c +12 -0
  59. metadata +6 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 125952c7d052ff2adaa683375a5e5079c4019f43ea9bc86546a4efd9eed2ed0e
4
- data.tar.gz: 8df793a9e6419ec7d4d137fec60811e0eadc68e8ebe6359a149cad43deb26f6e
3
+ metadata.gz: 0cb4ca04de969abdc9d7f58e67fb98a0ce0d39e6669dab1be23241ba08a1b883
4
+ data.tar.gz: c758f606ee5737b64c45fd4da9c99f6522f1a62a0b8a37b4023d37fcb69b6d59
5
5
  SHA512:
6
- metadata.gz: 254fc00d7c4bf3910796b4af6b573cf0be978b68a1db193a703a90e44e18df53b7399611d8acd40bff853e2c21fffd83468815fa24f71bdb36255b5cf164907a
7
- data.tar.gz: 0b4bf3195dede912a3eee97ea770e9c99b907eea6e7e28b5492818ee64d6128dc9d0262bab70d127c2e946a3f7f77536fa4a3fa884ea576f746231abcbfd9458
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/
@@ -11,7 +11,7 @@ jobs:
11
11
 
12
12
  steps:
13
13
  - name: Checkout repository
14
- uses: actions/checkout@v6
14
+ uses: actions/checkout@v7
15
15
 
16
16
  - name: Set up Ruby
17
17
  uses: ruby/setup-ruby@v1
@@ -14,7 +14,7 @@ jobs:
14
14
  format-check:
15
15
  runs-on: ubuntu-latest
16
16
  steps:
17
- - uses: actions/checkout@v6
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
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
31
- sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main"
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.3.tar.gz > re2c-4.3.tar.gz
42
- tar xf re2c-4.3.tar.gz
43
- cd re2c-4.3
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@v6
16
+ - uses: actions/checkout@v7
17
17
  - uses: ruby/setup-ruby@v1
18
18
  with:
19
- ruby-version: "4.0.1"
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@v6
20
+ uses: actions/checkout@v7
21
21
  with:
22
22
  fetch-depth: 0
23
23
  - name: Abort if blocker files are 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@v6
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: Assemble the JRuby runtime (rbs_parser.wasm + Chicory jars)
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
- run: gem install prism rake rake-compiler test-unit rdoc rspec minitest json-schema pry --no-document
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
- - uses: actions/checkout@v6
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: |
@@ -16,7 +16,7 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: ['3.2', '3.3', '3.4', '4.0', head]
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@v6
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@v6
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@v6
130
+ - uses: actions/checkout@v7
131
131
  - name: Install dependencies
132
132
  run: |
133
133
  brew install ruby-build
@@ -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@v6
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@v5
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@v6
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@v5
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@v6
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@v5
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@v6
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@v5
170
+ - uses: actions/cache@v6
169
171
  with:
170
172
  path: |
171
173
  ~/.cargo/registry
@@ -24,7 +24,7 @@ jobs:
24
24
  # TruffleRuby warns and falls back to US-ASCII unless the locale is UTF-8.
25
25
  LANG: "en_US.UTF-8"
26
26
  steps:
27
- - uses: actions/checkout@v6
27
+ - uses: actions/checkout@v7
28
28
  - uses: ruby/setup-ruby@v1
29
29
  with:
30
30
  ruby-version: ${{ matrix.ruby }}
@@ -16,10 +16,10 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  steps:
19
- - uses: actions/checkout@v6
19
+ - uses: actions/checkout@v7
20
20
  - uses: ruby/setup-ruby@v1
21
21
  with:
22
- ruby-version: "3.4"
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)
@@ -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: "v45.0.2"
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@v6
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
@@ -16,9 +16,9 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: ['3.4', ucrt, mswin]
19
+ ruby: ['4.0', ucrt, mswin]
20
20
  steps:
21
- - uses: actions/checkout@v6
21
+ - uses: actions/checkout@v7
22
22
  - name: load ruby
23
23
  uses: ruby/setup-ruby@v1
24
24
  with:
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 artifacts (assembled by rake wasm:jruby_setup, bundled in the JRuby gem)
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 and jars by default (see
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
- puts "Vendored Chicory #{CHICORY_VERSION} + ASM #{ASM_VERSION} into #{jars_dir}"
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 "Assemble everything the JRuby gem needs: the .wasm and the Chicory jars"
661
- task :jruby_setup => [:build, :vendor_jars] do
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 "JRuby runtime is ready under #{JRUBY_WASM_DIR}"
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"