rbs 4.1.0.pre.2-java → 4.1.1.dev.1-java

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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/.dockerignore +37 -0
  3. data/.github/dependabot.yml +1 -1
  4. data/.github/workflows/bundle-update.yml +2 -2
  5. data/.github/workflows/c-check.yml +11 -6
  6. data/.github/workflows/comments.yml +2 -2
  7. data/.github/workflows/dependabot.yml +1 -1
  8. data/.github/workflows/jruby.yml +15 -3
  9. data/.github/workflows/release-gems.yml +164 -0
  10. data/.github/workflows/ruby.yml +4 -4
  11. data/.github/workflows/rust.yml +10 -8
  12. data/.github/workflows/truffleruby.yml +1 -1
  13. data/.github/workflows/typecheck.yml +2 -2
  14. data/.github/workflows/wasm.yml +4 -2
  15. data/.github/workflows/windows.yml +2 -2
  16. data/.gitignore +3 -2
  17. data/CHANGELOG.md +88 -0
  18. data/Dockerfile.jruby +53 -0
  19. data/Rakefile +340 -60
  20. data/Steepfile +2 -0
  21. data/config.yml +2 -0
  22. data/core/array.rbs +228 -165
  23. data/core/float.rbs +0 -24
  24. data/core/match_data.rbs +1 -1
  25. data/core/pathname.rbs +0 -10
  26. data/core/ractor.rbs +0 -10
  27. data/core/rubygems/errors.rbs +4 -1
  28. data/core/rubygems/requirement.rbs +0 -10
  29. data/core/rubygems/rubygems.rbs +4 -1
  30. data/core/rubygems/specification.rbs +8 -0
  31. data/core/rubygems/version.rbs +0 -160
  32. data/core/thread.rbs +3 -8
  33. data/docs/CONTRIBUTING.md +1 -1
  34. data/docs/release.md +151 -0
  35. data/ext/rbs_extension/ast_translation.c +2 -2
  36. data/ext/rbs_extension/legacy_location.c +11 -6
  37. data/include/rbs/ast.h +4 -4
  38. data/lib/rbs/parser_aux.rb +4 -2
  39. data/lib/rbs/prototype/rbi.rb +193 -25
  40. data/lib/rbs/version.rb +1 -1
  41. data/lib/rbs/wasm/rbs_parser.wasm +0 -0
  42. data/lib/rbs/wasm/runtime.rb +7 -28
  43. data/lib/rbs_jars.rb +39 -0
  44. data/lib/rdoc_plugin/parser.rb +5 -0
  45. data/rbs.gemspec +16 -3
  46. data/sig/prototype/rbi.rbs +33 -4
  47. data/src/ast.c +2 -2
  48. data/src/lexer.c +97 -93
  49. data/src/lexer.re +1 -1
  50. data/src/lexstate.c +6 -2
  51. data/src/parser.c +6 -3
  52. data/src/util/rbs_allocator.c +13 -4
  53. data/stdlib/delegate/0/delegator.rbs +2 -1
  54. data/stdlib/digest/0/digest.rbs +10 -4
  55. data/stdlib/erb/0/erb.rbs +1 -1
  56. data/stdlib/ipaddr/0/ipaddr.rbs +0 -5
  57. data/stdlib/monitor/0/monitor.rbs +2 -2
  58. data/stdlib/openssl/0/openssl.rbs +39 -33
  59. data/stdlib/tempfile/0/manifest.yaml +3 -0
  60. data/stdlib/timeout/0/timeout.rbs +0 -5
  61. data/stdlib/uri/0/generic.rbs +0 -5
  62. data/stdlib/zlib/0/zstream.rbs +0 -1
  63. data/wasm/README.md +4 -3
  64. data/wasm/rbs_wasm.c +12 -0
  65. metadata +25 -14
  66. data/.github/workflows/milestone.yml +0 -83
  67. data/lib/rbs/wasm/jars/asm-analysis.jar +0 -0
  68. data/lib/rbs/wasm/jars/asm-commons.jar +0 -0
  69. data/lib/rbs/wasm/jars/asm-tree.jar +0 -0
  70. data/lib/rbs/wasm/jars/asm-util.jar +0 -0
  71. data/lib/rbs/wasm/jars/asm.jar +0 -0
  72. data/lib/rbs/wasm/jars/compiler.jar +0 -0
  73. data/lib/rbs/wasm/jars/log.jar +0 -0
  74. data/lib/rbs/wasm/jars/runtime.jar +0 -0
  75. data/lib/rbs/wasm/jars/wasi.jar +0 -0
  76. data/lib/rbs/wasm/jars/wasm.jar +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6eb1563b2016f3f0ccf6b152bf3558ac59f08aa2a363798aa9edaa58435b9e8c
4
- data.tar.gz: 1768c36ecc885a15245b55be53e143a0a1539cd66b17bf5b4deb457b09117352
3
+ metadata.gz: 56066190d5e0eaa7fceb57ad8040f658da10d46492f5d54f5393daddfb1f8fca
4
+ data.tar.gz: 4dd044bdcd79b8084863c8daff2e9544094ab16890eebde97be8a225e7ed8e6c
5
5
  SHA512:
6
- metadata.gz: fef9f364ff09d5f25b1d72ce73379e014b6f4d9770eb459154f21ab81866a6f2d79b75b96382017ffba5e642709c4df45b532653d5f0d852a6d51561ebb217b7
7
- data.tar.gz: 25a34f15697d48c400108f0e58a3517d3142a43d18709cc98873201e25e6929c346cf3f8de1760b6bc2029a3ac0f096021a7fa09f73ee5d29190891ad668c0fa
6
+ metadata.gz: 143b660efe763ad6e26ca669db797008bd1db81fbd68deb3c59502d4e37be28657bcb3e6dbeef961e03937c4369bfe56fec72a5ebc4f44cf5f247fe6e6629e18
7
+ data.tar.gz: e6f50f4d3212e2cb37fd608ffdb1e447f3ca9f8a822060441507d673cd16adfe2295f3612f2cec716cf0ff8d7e95087f833f40785af52d4d5ce7d7bcfb41893c
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/
@@ -21,4 +21,4 @@ updates:
21
21
  schedule:
22
22
  interval: 'weekly'
23
23
  labels:
24
- - 'no-milestone'
24
+ - 'skip-changelog'
@@ -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
@@ -58,6 +58,6 @@ jobs:
58
58
  --body "Automated weekly bundle update" \
59
59
  --head "$(git rev-parse --abbrev-ref HEAD)" \
60
60
  --base "${{ github.event.repository.default_branch }}" \
61
- --label "no-milestone"
61
+ --label "skip-changelog"
62
62
 
63
63
  gh pr merge --auto --merge "$(git rev-parse --abbrev-ref HEAD)"
@@ -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
@@ -0,0 +1,164 @@
1
+ name: Release gems
2
+
3
+ # Builds, publishes, and announces a release. Dispatch it against the `vX.Y.Z` tag
4
+ # of the release: the tag is created first so that everything published afterwards
5
+ # traces back to an immutable ref, and so the reversible step comes before the
6
+ # irreversible one.
7
+ #
8
+ # Dispatching against a branch builds and verifies the gems and stops there, which
9
+ # is how the build is exercised without releasing anything.
10
+ #
11
+ # | Gem | Platform | Parser |
12
+ # | -------------------- | ------------- | -------------------------------- |
13
+ # | `rbs-X.Y.Z.gem` | `ruby` (MRI) | C extension, compiled on install |
14
+ # | `rbs-X.Y.Z-java.gem` | `java` (JRuby)| `rbs_parser.wasm`, prebuilt here |
15
+ #
16
+ # See docs/release.md. The `java` gem is built on CRuby: the platform comes from
17
+ # `RBS_PLATFORM`, not from the engine running `gem build`. JRuby is only needed to
18
+ # run the result, which the workflow does before it would publish anything.
19
+ #
20
+ # One job on purpose. Tagging, pushing the gems, and opening the GitHub release
21
+ # all belong to a single release, and keeping them in one place keeps their order
22
+ # readable -- the tag is created before anything is published, so the reversible
23
+ # step comes before the irreversible one.
24
+
25
+ on:
26
+ workflow_dispatch:
27
+
28
+ permissions:
29
+ contents: read
30
+
31
+ env:
32
+ # Keep in sync with .github/workflows/wasm.yml and .github/workflows/jruby.yml.
33
+ WASI_SDK_VERSION: "33"
34
+ WASI_SDK_RELEASE: "33.0"
35
+
36
+ jobs:
37
+ release:
38
+ name: release
39
+ runs-on: ubuntu-latest
40
+ permissions:
41
+ contents: write # publish the GitHub release
42
+ id-token: write # trusted publishing to RubyGems
43
+ steps:
44
+ # The gemspec takes its file list from `git ls-files`, so both gems are built
45
+ # from the committed state.
46
+ - uses: actions/checkout@v7
47
+ - name: Set up Ruby
48
+ uses: ruby/setup-ruby@v1
49
+ with:
50
+ ruby-version: ruby
51
+ bundler: none
52
+ - name: Update rubygems & bundler
53
+ run: gem update --system
54
+ - name: Install gems
55
+ run: |
56
+ bundle config set --local without libs:profilers
57
+ bundle install --jobs 4 --retry 3
58
+
59
+ - name: Read the version
60
+ id: version
61
+ run: echo "version=$(ruby -e 'load "lib/rbs/version.rb"; print RBS::VERSION')" >> "$GITHUB_OUTPUT"
62
+
63
+ # Fail before spending a minute on the build, and before anything is pushed:
64
+ # the tag is what the release is named after, so it has to be the version the
65
+ # tagged commit actually declares.
66
+ - name: Check the tag against RBS::VERSION
67
+ if: github.ref_type == 'tag'
68
+ run: |
69
+ if [ "${{ github.ref_name }}" != "v${{ steps.version.outputs.version }}" ]; then
70
+ echo "::error::tag ${{ github.ref_name }} does not match RBS::VERSION ${{ steps.version.outputs.version }}"
71
+ exit 1
72
+ fi
73
+
74
+ - name: Build the ruby gem
75
+ run: |
76
+ mkdir -p pkg
77
+ gem build rbs.gemspec -o "pkg/rbs-${{ steps.version.outputs.version }}.gem"
78
+
79
+ # `rake wasm:jruby_setup` compiles src/**/*.c to WebAssembly and copies the
80
+ # result to lib/rbs/wasm/, where the gemspec picks it up. clang runs as a
81
+ # subprocess, so this works on CRuby.
82
+ - name: Install the WASI SDK
83
+ run: |
84
+ url="https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_RELEASE}-x86_64-linux.tar.gz"
85
+ mkdir -p "$HOME/wasi-sdk"
86
+ curl -sSL "$url" | tar xz --strip-components=1 -C "$HOME/wasi-sdk"
87
+ echo "WASI_SDK_PATH=$HOME/wasi-sdk" >> "$GITHUB_ENV"
88
+ - name: Build rbs_parser.wasm
89
+ run: bundle exec rake wasm:jruby_setup
90
+
91
+ - name: Build the java gem
92
+ env:
93
+ RBS_PLATFORM: java
94
+ run: gem build rbs.gemspec -o "pkg/rbs-${{ steps.version.outputs.version }}-java.gem"
95
+
96
+ # `git ls-files` vouches for everything else, but rbs_parser.wasm is a build
97
+ # artifact, so the java gem is the one that can come out quietly wrong.
98
+ - name: Check the built gems
99
+ run: |
100
+ ruby -rrubygems/package -e '
101
+ ruby_gem, java_gem = ARGV.map { Gem::Package.new(_1).spec }
102
+
103
+ raise "unexpected platform: #{ruby_gem.platform}" unless ruby_gem.platform.to_s == "ruby"
104
+ raise "the C extension is not declared" if ruby_gem.extensions.empty?
105
+
106
+ raise "unexpected platform: #{java_gem.platform}" unless java_gem.platform.to_s == "java"
107
+ raise "rbs_parser.wasm is missing" unless java_gem.files.include?("lib/rbs/wasm/rbs_parser.wasm")
108
+ raise "the java gem must not declare an extension" unless java_gem.extensions.empty?
109
+
110
+ [ruby_gem, java_gem].each { puts "#{_1.full_name}: #{_1.files.size} files" }
111
+ ' "pkg/rbs-${{ steps.version.outputs.version }}.gem" \
112
+ "pkg/rbs-${{ steps.version.outputs.version }}-java.gem"
113
+
114
+ # The checks above cannot tell whether rbs_parser.wasm actually runs. Install
115
+ # the gem the way a user would -- jar-dependencies fetches Chicory and ASM
116
+ # from Maven during the install -- and parse something with it, so the
117
+ # WebAssembly runtime is exercised end to end before anything is published.
118
+ - name: Set up JRuby
119
+ uses: ruby/setup-ruby@v1
120
+ with:
121
+ ruby-version: jruby
122
+ bundler: none
123
+ - name: Check the java gem on JRuby
124
+ run: |
125
+ gem install "pkg/rbs-${{ steps.version.outputs.version }}-java.gem"
126
+ ruby -e '
127
+ require "rbs"
128
+ _, _, decls = RBS::Parser.parse_signature("class Foo end")
129
+ names = decls.map { _1.name.to_s }
130
+ raise "parsed #{names.inspect}, expected [\"Foo\"]" unless names == ["Foo"]
131
+ puts "#{RUBY_ENGINE} #{RUBY_VERSION}: rbs #{RBS::VERSION} parses through the WebAssembly runtime"
132
+ '
133
+
134
+ - name: Switch back to CRuby
135
+ uses: ruby/setup-ruby@v1
136
+ with:
137
+ ruby-version: ruby
138
+ bundler: none
139
+
140
+ # Uploaded before publishing, so a failed push still leaves the gems behind.
141
+ - uses: actions/upload-artifact@v7
142
+ with:
143
+ name: gems
144
+ path: pkg/*.gem
145
+ if-no-files-found: error
146
+
147
+ # Everything below runs only for a release tag.
148
+ - name: Configure RubyGems credentials
149
+ if: github.ref_type == 'tag'
150
+ # No floating major tag on this action, so the exact release is pinned.
151
+ uses: rubygems/configure-rubygems-credentials@v2.1.0
152
+
153
+ - name: Push the gems
154
+ if: github.ref_type == 'tag'
155
+ run: |
156
+ gem push "pkg/rbs-${{ steps.version.outputs.version }}.gem"
157
+ gem push "pkg/rbs-${{ steps.version.outputs.version }}-java.gem"
158
+
159
+ # Last, so that a failed push never announces a release that has no gems.
160
+ - name: Publish the GitHub release
161
+ if: github.ref_type == 'tag'
162
+ env:
163
+ GH_TOKEN: ${{ github.token }}
164
+ run: bundle exec rake gem:gh_release
@@ -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