rbs 3.9.5 → 4.0.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/.clang-format +74 -0
- data/.clangd +2 -0
- data/.github/dependabot.yml +14 -14
- data/.github/workflows/bundle-update.yml +60 -0
- data/.github/workflows/c-check.yml +58 -0
- data/.github/workflows/comments.yml +5 -3
- data/.github/workflows/dependabot.yml +2 -2
- data/.github/workflows/ruby.yml +40 -32
- data/.github/workflows/rust.yml +95 -0
- data/.github/workflows/typecheck.yml +2 -2
- data/.github/workflows/windows.yml +3 -3
- data/.gitignore +4 -0
- data/.rubocop.yml +2 -2
- data/.vscode/extensions.json +5 -0
- data/.vscode/settings.json +19 -0
- data/CHANGELOG.md +284 -0
- data/README.md +38 -1
- data/Rakefile +144 -29
- data/Steepfile +2 -0
- data/config.yml +634 -62
- data/core/array.rbs +307 -227
- data/core/basic_object.rbs +9 -8
- data/core/binding.rbs +0 -2
- data/core/builtin.rbs +2 -2
- data/core/class.rbs +6 -5
- data/core/comparable.rbs +55 -34
- data/core/complex.rbs +104 -78
- data/core/dir.rbs +61 -49
- data/core/encoding.rbs +12 -15
- data/core/enumerable.rbs +188 -87
- data/core/enumerator/arithmetic_sequence.rbs +70 -0
- data/core/enumerator.rbs +65 -2
- data/core/errno.rbs +11 -2
- data/core/errors.rbs +58 -29
- data/core/exception.rbs +13 -13
- data/core/fiber.rbs +74 -54
- data/core/file.rbs +280 -177
- data/core/file_test.rbs +3 -3
- data/core/float.rbs +257 -92
- data/core/gc.rbs +425 -281
- data/core/hash.rbs +1045 -739
- data/core/integer.rbs +135 -137
- data/core/io/buffer.rbs +53 -42
- data/core/io/wait.rbs +13 -35
- data/core/io.rbs +196 -148
- data/core/kernel.rbs +216 -155
- data/core/marshal.rbs +4 -4
- data/core/match_data.rbs +15 -13
- data/core/math.rbs +107 -66
- data/core/method.rbs +69 -33
- data/core/module.rbs +244 -106
- data/core/nil_class.rbs +7 -6
- data/core/numeric.rbs +74 -63
- data/core/object.rbs +9 -11
- data/core/object_space.rbs +30 -23
- data/core/pathname.rbs +1322 -0
- data/core/proc.rbs +95 -58
- data/core/process.rbs +222 -202
- data/core/ractor.rbs +371 -515
- data/core/random.rbs +21 -3
- data/core/range.rbs +159 -57
- data/core/rational.rbs +60 -89
- data/core/rbs/unnamed/argf.rbs +60 -53
- data/core/rbs/unnamed/env_class.rbs +19 -14
- data/core/rbs/unnamed/main_class.rbs +123 -0
- data/core/rbs/unnamed/random.rbs +11 -118
- data/core/regexp.rbs +258 -214
- data/core/ruby.rbs +53 -0
- data/core/ruby_vm.rbs +38 -34
- data/core/rubygems/config_file.rbs +5 -5
- data/core/rubygems/errors.rbs +4 -71
- data/core/rubygems/requirement.rbs +5 -5
- data/core/rubygems/rubygems.rbs +16 -82
- data/core/rubygems/version.rbs +2 -3
- data/core/set.rbs +490 -360
- data/core/signal.rbs +26 -16
- data/core/string.rbs +3303 -1365
- data/core/struct.rbs +27 -26
- data/core/symbol.rbs +41 -34
- data/core/thread.rbs +135 -74
- data/core/time.rbs +81 -50
- data/core/trace_point.rbs +41 -35
- data/core/true_class.rbs +2 -2
- data/core/unbound_method.rbs +24 -16
- data/core/warning.rbs +7 -7
- data/docs/aliases.md +79 -0
- data/docs/collection.md +3 -3
- data/docs/config.md +171 -0
- data/docs/encoding.md +56 -0
- data/docs/gem.md +0 -1
- data/docs/inline.md +576 -0
- data/docs/sigs.md +3 -3
- data/docs/syntax.md +46 -16
- data/docs/type_fingerprint.md +21 -0
- data/exe/rbs +1 -1
- data/ext/rbs_extension/ast_translation.c +1513 -0
- data/ext/rbs_extension/ast_translation.h +37 -0
- data/ext/rbs_extension/class_constants.c +185 -0
- data/{include/rbs/constants.h → ext/rbs_extension/class_constants.h} +22 -1
- data/ext/rbs_extension/compat.h +10 -0
- data/ext/rbs_extension/extconf.rb +25 -1
- data/ext/rbs_extension/legacy_location.c +294 -0
- data/ext/rbs_extension/legacy_location.h +82 -0
- data/ext/rbs_extension/main.c +468 -24
- data/ext/rbs_extension/rbs_extension.h +6 -21
- data/ext/rbs_extension/rbs_string_bridging.c +9 -0
- data/ext/rbs_extension/rbs_string_bridging.h +24 -0
- data/include/rbs/ast.h +1022 -0
- data/include/rbs/defines.h +86 -0
- data/include/rbs/lexer.h +206 -0
- data/include/rbs/location.h +40 -0
- data/include/rbs/parser.h +153 -0
- data/include/rbs/string.h +47 -0
- data/include/rbs/util/rbs_allocator.h +59 -0
- data/include/rbs/util/rbs_assert.h +20 -0
- data/include/rbs/util/rbs_buffer.h +83 -0
- data/include/rbs/util/rbs_constant_pool.h +6 -70
- data/include/rbs/util/rbs_encoding.h +282 -0
- data/include/rbs/util/rbs_unescape.h +24 -0
- data/include/rbs.h +9 -2
- data/lib/rbs/annotate/formatter.rb +3 -13
- data/lib/rbs/annotate/rdoc_annotator.rb +3 -1
- data/lib/rbs/annotate/rdoc_source.rb +1 -1
- data/lib/rbs/ast/annotation.rb +1 -1
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/ast/declarations.rb +10 -10
- data/lib/rbs/ast/members.rb +14 -14
- data/lib/rbs/ast/ruby/annotations.rb +409 -0
- data/lib/rbs/ast/ruby/comment_block.rb +245 -0
- data/lib/rbs/ast/ruby/declarations.rb +281 -0
- data/lib/rbs/ast/ruby/helpers/constant_helper.rb +28 -0
- data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
- data/lib/rbs/ast/ruby/members.rb +723 -0
- data/lib/rbs/ast/type_param.rb +24 -4
- data/lib/rbs/buffer.rb +105 -20
- data/lib/rbs/cli/diff.rb +16 -15
- data/lib/rbs/cli/validate.rb +63 -126
- data/lib/rbs/cli.rb +56 -24
- data/lib/rbs/collection/config/lockfile_generator.rb +14 -2
- data/lib/rbs/collection/sources/git.rb +1 -0
- data/lib/rbs/collection.rb +0 -1
- data/lib/rbs/definition.rb +6 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +121 -65
- data/lib/rbs/definition_builder/method_builder.rb +65 -30
- data/lib/rbs/definition_builder.rb +177 -20
- data/lib/rbs/diff.rb +7 -1
- data/lib/rbs/environment/class_entry.rb +69 -0
- data/lib/rbs/environment/module_entry.rb +66 -0
- data/lib/rbs/environment.rb +402 -214
- data/lib/rbs/environment_loader.rb +2 -8
- data/lib/rbs/errors.rb +31 -21
- data/lib/rbs/inline_parser/comment_association.rb +117 -0
- data/lib/rbs/inline_parser.rb +542 -0
- data/lib/rbs/location_aux.rb +36 -4
- data/lib/rbs/locator.rb +5 -1
- data/lib/rbs/method_type.rb +5 -3
- data/lib/rbs/namespace.rb +0 -7
- data/lib/rbs/parser_aux.rb +35 -7
- data/lib/rbs/prototype/helpers.rb +57 -0
- data/lib/rbs/prototype/rb.rb +3 -28
- data/lib/rbs/prototype/rbi.rb +3 -20
- data/lib/rbs/prototype/runtime.rb +10 -2
- data/lib/rbs/resolver/constant_resolver.rb +2 -2
- data/lib/rbs/resolver/type_name_resolver.rb +116 -38
- data/lib/rbs/source.rb +99 -0
- data/lib/rbs/subtractor.rb +7 -4
- data/lib/rbs/test/type_check.rb +19 -2
- data/lib/rbs/type_name.rb +1 -8
- data/lib/rbs/types.rb +91 -79
- data/lib/rbs/unit_test/convertibles.rb +1 -0
- data/lib/rbs/unit_test/type_assertions.rb +35 -8
- data/lib/rbs/validator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +13 -2
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +3 -3
- data/rbs.gemspec +4 -2
- data/rust/.gitignore +1 -0
- data/rust/Cargo.lock +378 -0
- data/rust/Cargo.toml +7 -0
- data/rust/ruby-rbs/Cargo.toml +22 -0
- data/rust/ruby-rbs/build.rs +764 -0
- data/rust/ruby-rbs/examples/locations.rs +60 -0
- data/rust/ruby-rbs/src/lib.rs +1 -0
- data/rust/ruby-rbs/src/node/mod.rs +742 -0
- data/rust/ruby-rbs/tests/sanity.rs +47 -0
- data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
- data/rust/ruby-rbs-sys/Cargo.toml +23 -0
- data/rust/ruby-rbs-sys/build.rs +204 -0
- data/rust/ruby-rbs-sys/src/lib.rs +50 -0
- data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
- data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
- data/rust/ruby-rbs-sys/wrapper.h +1 -0
- data/schema/typeParam.json +17 -1
- data/sig/ancestor_builder.rbs +1 -1
- data/sig/annotate/formatter.rbs +2 -2
- data/sig/annotate/rdoc_annotater.rbs +1 -1
- data/sig/ast/ruby/annotations.rbs +421 -0
- data/sig/ast/ruby/comment_block.rbs +127 -0
- data/sig/ast/ruby/declarations.rbs +158 -0
- data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
- data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
- data/sig/ast/ruby/members.rbs +178 -0
- data/sig/buffer.rbs +63 -5
- data/sig/cli/diff.rbs +5 -11
- data/sig/cli/validate.rbs +12 -8
- data/sig/cli.rbs +18 -18
- data/sig/definition.rbs +6 -0
- data/sig/definition_builder.rbs +3 -1
- data/sig/environment/class_entry.rbs +50 -0
- data/sig/environment/module_entry.rbs +50 -0
- data/sig/environment.rbs +94 -87
- data/sig/errors.rbs +26 -20
- data/sig/inline_parser/comment_association.rbs +71 -0
- data/sig/inline_parser.rbs +124 -0
- data/sig/location.rbs +32 -7
- data/sig/locator.rbs +0 -2
- data/sig/manifest.yaml +0 -1
- data/sig/method_builder.rbs +9 -4
- data/sig/namespace.rbs +0 -5
- data/sig/parser.rbs +67 -13
- data/sig/prototype/helpers.rbs +2 -0
- data/sig/resolver/type_name_resolver.rbs +35 -7
- data/sig/source.rbs +48 -0
- data/sig/type_param.rbs +13 -8
- data/sig/typename.rbs +0 -5
- data/sig/types.rbs +10 -8
- data/sig/unit_test/spy.rbs +0 -8
- data/sig/unit_test/type_assertions.rbs +11 -0
- data/src/ast.c +1604 -0
- data/src/lexer.c +3194 -0
- data/src/lexer.re +154 -0
- data/src/lexstate.c +212 -0
- data/src/location.c +31 -0
- data/src/parser.c +4205 -0
- data/src/string.c +41 -0
- data/src/util/rbs_allocator.c +165 -0
- data/src/util/rbs_assert.c +19 -0
- data/src/util/rbs_buffer.c +54 -0
- data/src/util/rbs_constant_pool.c +18 -92
- data/src/util/rbs_encoding.c +21308 -0
- data/src/util/rbs_unescape.c +167 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +116 -98
- data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
- data/stdlib/cgi/0/core.rbs +9 -393
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/cgi-escape/0/escape.rbs +171 -0
- data/stdlib/coverage/0/coverage.rbs +7 -4
- data/stdlib/date/0/date.rbs +92 -79
- data/stdlib/date/0/date_time.rbs +25 -24
- data/stdlib/delegate/0/delegator.rbs +10 -7
- data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
- data/stdlib/digest/0/digest.rbs +110 -0
- data/stdlib/erb/0/erb.rbs +748 -347
- data/stdlib/etc/0/etc.rbs +55 -50
- data/stdlib/fileutils/0/fileutils.rbs +158 -139
- data/stdlib/forwardable/0/forwardable.rbs +13 -10
- data/stdlib/io-console/0/io-console.rbs +2 -2
- data/stdlib/json/0/json.rbs +226 -179
- data/stdlib/monitor/0/monitor.rbs +3 -3
- data/stdlib/net-http/0/net-http.rbs +162 -134
- data/stdlib/objspace/0/objspace.rbs +17 -34
- data/stdlib/open-uri/0/open-uri.rbs +48 -8
- data/stdlib/open3/0/open3.rbs +469 -10
- data/stdlib/openssl/0/openssl.rbs +475 -357
- data/stdlib/optparse/0/optparse.rbs +26 -17
- data/stdlib/pathname/0/pathname.rbs +11 -1381
- data/stdlib/pp/0/pp.rbs +9 -8
- data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
- data/stdlib/pstore/0/pstore.rbs +35 -30
- data/stdlib/psych/0/psych.rbs +65 -12
- data/stdlib/psych/0/store.rbs +2 -4
- data/stdlib/pty/0/pty.rbs +9 -6
- data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
- data/stdlib/rdoc/0/code_object.rbs +4 -3
- data/stdlib/rdoc/0/comment.rbs +2 -0
- data/stdlib/rdoc/0/options.rbs +76 -0
- data/stdlib/rdoc/0/parser.rbs +1 -1
- data/stdlib/rdoc/0/rdoc.rbs +7 -5
- data/stdlib/rdoc/0/store.rbs +2 -2
- data/stdlib/resolv/0/resolv.rbs +25 -68
- data/stdlib/ripper/0/ripper.rbs +25 -19
- data/stdlib/securerandom/0/manifest.yaml +2 -0
- data/stdlib/securerandom/0/securerandom.rbs +7 -20
- data/stdlib/shellwords/0/shellwords.rbs +2 -2
- data/stdlib/singleton/0/singleton.rbs +3 -0
- data/stdlib/socket/0/addrinfo.rbs +9 -9
- data/stdlib/socket/0/basic_socket.rbs +3 -3
- data/stdlib/socket/0/ip_socket.rbs +10 -8
- data/stdlib/socket/0/socket.rbs +23 -10
- data/stdlib/socket/0/tcp_server.rbs +1 -1
- data/stdlib/socket/0/tcp_socket.rbs +11 -3
- data/stdlib/socket/0/udp_socket.rbs +1 -1
- data/stdlib/socket/0/unix_server.rbs +1 -1
- data/stdlib/stringio/0/stringio.rbs +1177 -85
- data/stdlib/strscan/0/string_scanner.rbs +27 -25
- data/stdlib/tempfile/0/tempfile.rbs +25 -21
- data/stdlib/time/0/time.rbs +8 -6
- data/stdlib/timeout/0/timeout.rbs +63 -7
- data/stdlib/tsort/0/cyclic.rbs +3 -0
- data/stdlib/tsort/0/tsort.rbs +7 -6
- data/stdlib/uri/0/common.rbs +42 -20
- data/stdlib/uri/0/file.rbs +3 -3
- data/stdlib/uri/0/generic.rbs +26 -18
- data/stdlib/uri/0/http.rbs +2 -2
- data/stdlib/uri/0/ldap.rbs +2 -2
- data/stdlib/uri/0/mailto.rbs +3 -3
- data/stdlib/uri/0/rfc2396_parser.rbs +12 -12
- data/stdlib/zlib/0/deflate.rbs +4 -3
- data/stdlib/zlib/0/gzip_reader.rbs +6 -6
- data/stdlib/zlib/0/gzip_writer.rbs +14 -12
- data/stdlib/zlib/0/inflate.rbs +1 -1
- data/stdlib/zlib/0/need_dict.rbs +1 -1
- data/stdlib/zlib/0/zstream.rbs +1 -0
- metadata +121 -18
- data/ext/rbs_extension/lexer.c +0 -2728
- data/ext/rbs_extension/lexer.h +0 -179
- data/ext/rbs_extension/lexer.re +0 -147
- data/ext/rbs_extension/lexstate.c +0 -175
- data/ext/rbs_extension/location.c +0 -325
- data/ext/rbs_extension/location.h +0 -85
- data/ext/rbs_extension/parser.c +0 -2982
- data/ext/rbs_extension/parser.h +0 -18
- data/ext/rbs_extension/parserstate.c +0 -411
- data/ext/rbs_extension/parserstate.h +0 -163
- data/ext/rbs_extension/unescape.c +0 -32
- data/include/rbs/ruby_objs.h +0 -72
- data/src/constants.c +0 -153
- data/src/ruby_objs.c +0 -799
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,289 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 4.0.0 (2026-03-16)
|
|
4
|
+
|
|
5
|
+
RBS 4.0 ships with experimental RBS inline syntax support, allowing you to write type annotations directly in Ruby source files. See [docs/inline.md](docs/inline.md) for the syntax details.
|
|
6
|
+
|
|
7
|
+
```ruby
|
|
8
|
+
class Calculator
|
|
9
|
+
# @rbs (Integer, Integer) -> Integer
|
|
10
|
+
def add(a, b) = a + b
|
|
11
|
+
end
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Note: RBS inline is still experimental and may change in future releases.
|
|
15
|
+
|
|
16
|
+
This release also introduces two language changes: type argument support for singleton types (`singleton(T)[S]`) mainly for Sorbet integration, and generic type parameter lower bounds (`T < S`).
|
|
17
|
+
|
|
18
|
+
### Signature updates
|
|
19
|
+
|
|
20
|
+
**Updated classes/modules/methods:** `Addrinfo`, `Array`, `BasicObject`, `BigDecimal`, `Binding`, `CGI`, `Comparable`, `Complex`, `Digest::SHA2`, `Encoding::Converter`, `Enumerable`, `Enumerator`, `Enumerator::ArithmeticSequence`, `Enumerator::Lazy`, `Fiber`, `File`, `FileUtils`, `Float`, `Hash`, `IO`, `IO::TimeoutError`, `Integer`, `JSON`, `Kernel`, `Kconv`, `Math`, `Method`, `Minitest`, `Module`, `Numeric`, `ObjectSpace`, `Open3`, `OpenURI`, `OptionParser`, `PStore`, `Pathname`, `Proc`, `Process::Status`, `Psych`, `Ractor`, `Random`, `Random::Formatter`, `Range`, `Rational`, `RBS::Unnamed::TopLevelSelfClass`, `Ripper::Lexer::Elem`, `Ruby`, `RubyVM`, `SecureRandom`, `Set`, `Socket`, `String`, `StringScanner`, `TCPSocket`, `Thread`, `URI`, `URI::Generic`, `Zlib::GzipReader`, `Zlib::GzipWriter`
|
|
21
|
+
|
|
22
|
+
* Remove deprecated types ([#2880](https://github.com/ruby/rbs/pull/2880))
|
|
23
|
+
* Add type `RBS::Unnamed::TopLevelSelfClass` to core ([#2362](https://github.com/ruby/rbs/pull/2362))
|
|
24
|
+
* Graduate bundled gems from Ruby v4.0 ([#2852](https://github.com/ruby/rbs/pull/2852))
|
|
25
|
+
* stdlib: Add missing Psych methods and exception classes ([#2850](https://github.com/ruby/rbs/pull/2850))
|
|
26
|
+
* Add variants with positional argument to `Hash#transform_keys` ([#2848](https://github.com/ruby/rbs/pull/2848))
|
|
27
|
+
* add extra kwarg options for File#initialize and derivatives ([#2798](https://github.com/ruby/rbs/pull/2798))
|
|
28
|
+
* pstore: fixes types, treat it as a collection ([#2806](https://github.com/ruby/rbs/pull/2806))
|
|
29
|
+
* Add signatures for `{Module,Proc}#ruby2_keywords` ([#2805](https://github.com/ruby/rbs/pull/2805))
|
|
30
|
+
* Make Zlib::GzipWriter.new level and strategy parameters optional ([#2810](https://github.com/ruby/rbs/pull/2810))
|
|
31
|
+
* URI.(s) does string coercion ([#2825](https://github.com/ruby/rbs/pull/2825))
|
|
32
|
+
* Fix String#append_as_bytes to accept Integer ([#2817](https://github.com/ruby/rbs/pull/2817))
|
|
33
|
+
* [Comparable] Add in Comparable::_CompareToZero ([#2697](https://github.com/ruby/rbs/pull/2697))
|
|
34
|
+
* [Kernel] Add Kernel.trace_var and Kernel.untrace_var ([#2682](https://github.com/ruby/rbs/pull/2682))
|
|
35
|
+
* Add signature for `Module#method_undefined` ([#2804](https://github.com/ruby/rbs/pull/2804))
|
|
36
|
+
* Fix Zlib::GzipWriter signatures ([#2803](https://github.com/ruby/rbs/pull/2803))
|
|
37
|
+
* GzipWriter#initialize only takes 1 required positional arg ([#2799](https://github.com/ruby/rbs/pull/2799))
|
|
38
|
+
* Fix accessibility of method in Module ([#2802](https://github.com/ruby/rbs/pull/2802))
|
|
39
|
+
* Graduate kconv ([#2794](https://github.com/ruby/rbs/pull/2794))
|
|
40
|
+
* Fix test related to pathname ([#2789](https://github.com/ruby/rbs/pull/2789))
|
|
41
|
+
* Split pathname to core and stdlib ([#2777](https://github.com/ruby/rbs/pull/2777))
|
|
42
|
+
* [Kernel] Narrow `caller_locations` ([#2745](https://github.com/ruby/rbs/pull/2745))
|
|
43
|
+
* Ruby 4.1 changed `source_location` type ([#2784](https://github.com/ruby/rbs/pull/2784))
|
|
44
|
+
* Remove ObjectSpace.count_nodes ([#2779](https://github.com/ruby/rbs/pull/2779))
|
|
45
|
+
* Support selector for `String#strip` family. ([#2775](https://github.com/ruby/rbs/pull/2775))
|
|
46
|
+
* Add `Ruby`, `Array#find`, and `Array#rfind` ([#2767](https://github.com/ruby/rbs/pull/2767))
|
|
47
|
+
* Update minitest ([#2761](https://github.com/ruby/rbs/pull/2761))
|
|
48
|
+
* Support BigDecimal v4 ([#2758](https://github.com/ruby/rbs/pull/2758))
|
|
49
|
+
* Update rdoc and comments ([#2733](https://github.com/ruby/rbs/pull/2733))
|
|
50
|
+
* Update cgi and cgi/escape type definitions ([#2728](https://github.com/ruby/rbs/pull/2728))
|
|
51
|
+
* Update RBS files for Ruby 4 ([#2731](https://github.com/ruby/rbs/pull/2731))
|
|
52
|
+
* Update existing docs ([#2724](https://github.com/ruby/rbs/pull/2724))
|
|
53
|
+
* Remove reference to `JSON.deep_const_get` ([#2701](https://github.com/ruby/rbs/pull/2701))
|
|
54
|
+
* Remove deprecated methods in `JSON` ([#2366](https://github.com/ruby/rbs/pull/2366))
|
|
55
|
+
* Update FileUtils to v1.8.0 ([#2700](https://github.com/ruby/rbs/pull/2700))
|
|
56
|
+
* Avoid overloading where arguments are identical ([#2559](https://github.com/ruby/rbs/pull/2559))
|
|
57
|
+
* Move Pathname to core from stdlib ([#2705](https://github.com/ruby/rbs/pull/2705))
|
|
58
|
+
* Remove undocumented `#nonzero?` ([#2543](https://github.com/ruby/rbs/pull/2543))
|
|
59
|
+
* Add signature for `OptionParser#raise_unknown` ([#2735](https://github.com/ruby/rbs/pull/2735))
|
|
60
|
+
* Add signature for `Open3.popen2` ([#2734](https://github.com/ruby/rbs/pull/2734))
|
|
61
|
+
* Add RFC2396_PARSER to URI module ([#2727](https://github.com/ruby/rbs/pull/2727))
|
|
62
|
+
* Add signature for `Open3.capture3` ([#2714](https://github.com/ruby/rbs/pull/2714))
|
|
63
|
+
* Remove sig for IO#{ready?,nread} ([#2710](https://github.com/ruby/rbs/pull/2710))
|
|
64
|
+
* Accept `nil` state parameter in `to_json` type signatures ([#2691](https://github.com/ruby/rbs/pull/2691))
|
|
65
|
+
* Add type of `Open3.popen3` ([#2699](https://github.com/ruby/rbs/pull/2699))
|
|
66
|
+
* `unsetenv_others` and `close_others` only allows bool. ([#2698](https://github.com/ruby/rbs/pull/2698))
|
|
67
|
+
* Add deprecated annotation to `attr` with bool args ([#2693](https://github.com/ruby/rbs/pull/2693))
|
|
68
|
+
* Update open3 ([#2692](https://github.com/ruby/rbs/pull/2692))
|
|
69
|
+
* Add signature for `SecureRandom.bytes` ([#2690](https://github.com/ruby/rbs/pull/2690))
|
|
70
|
+
* Set %a{deprecated} to deprecated core methods ([#2664](https://github.com/ruby/rbs/pull/2664))
|
|
71
|
+
* Migrate usages of ::_ToPath to use ::path instead ([#2677](https://github.com/ruby/rbs/pull/2677))
|
|
72
|
+
* Add missing signatures for `Random::Formatter` ([#2680](https://github.com/ruby/rbs/pull/2680))
|
|
73
|
+
* Split `Random::Formatter` to core and stdlib ([#2661](https://github.com/ruby/rbs/pull/2661))
|
|
74
|
+
* Skip test cases of developing methods for Pathname ([#2648](https://github.com/ruby/rbs/pull/2648))
|
|
75
|
+
* Add signature `Random.seed` ([#2649](https://github.com/ruby/rbs/pull/2649))
|
|
76
|
+
* Update `string.rbs` to avoid deprecation warning in Steep ([#2655](https://github.com/ruby/rbs/pull/2655))
|
|
77
|
+
* Add sig `IO#pread` and `IO#pwrite` ([#2647](https://github.com/ruby/rbs/pull/2647))
|
|
78
|
+
* Refine signature of `Numeric#step` and add type of `Enumerator::ArithmeticSequence` ([#2600](https://github.com/ruby/rbs/pull/2600))
|
|
79
|
+
* Remove undocumented override methods ([#2622](https://github.com/ruby/rbs/pull/2622))
|
|
80
|
+
* Add docs ([#2625](https://github.com/ruby/rbs/pull/2625))
|
|
81
|
+
* Remove undocumented methods for `imaginary` ([#2620](https://github.com/ruby/rbs/pull/2620))
|
|
82
|
+
* Update securerandom ([#2619](https://github.com/ruby/rbs/pull/2619))
|
|
83
|
+
* Drop undocumented `#eql?` ([#2618](https://github.com/ruby/rbs/pull/2618))
|
|
84
|
+
* Just use `Numeric#+@` and return self ([#2597](https://github.com/ruby/rbs/pull/2597))
|
|
85
|
+
* Drop undocumented `#dup` ([#2598](https://github.com/ruby/rbs/pull/2598))
|
|
86
|
+
* Add signature for `Digest::SHA2` ([#2573](https://github.com/ruby/rbs/pull/2573))
|
|
87
|
+
* Add signatures for `OpenURI` ([#2574](https://github.com/ruby/rbs/pull/2574))
|
|
88
|
+
* Add signature for `IO::TimeoutError` ([#2571](https://github.com/ruby/rbs/pull/2571))
|
|
89
|
+
* Add signatures for `Set` ([#2570](https://github.com/ruby/rbs/pull/2570))
|
|
90
|
+
* Add signature for `Enumerator#+` ([#2567](https://github.com/ruby/rbs/pull/2567))
|
|
91
|
+
* Add signature for `Enumerator::Lazy#eager` ([#2568](https://github.com/ruby/rbs/pull/2568))
|
|
92
|
+
* Add signature for `Fiber#blocking` ([#2566](https://github.com/ruby/rbs/pull/2566))
|
|
93
|
+
* Support BasicObject to avoid NoMethodError for `RBS::Test::TypeCheck` ([#2565](https://github.com/ruby/rbs/pull/2565))
|
|
94
|
+
* Add documentation for `Range#{minmax,count,to_a,entries}` ([#2562](https://github.com/ruby/rbs/pull/2562))
|
|
95
|
+
* Delegate to `Enumerable` from `Range#{min,max}` ([#2540](https://github.com/ruby/rbs/pull/2540))
|
|
96
|
+
* Add URI::Generic#+ ([#2535](https://github.com/ruby/rbs/pull/2535))
|
|
97
|
+
* Make IO.binread, IO.binwrite, IO.read and IO.write accept _ToPath ([#2378](https://github.com/ruby/rbs/pull/2378))
|
|
98
|
+
* Support pattern argument for Enumerable#{all,any,none,one}? ([#2368](https://github.com/ruby/rbs/pull/2368))
|
|
99
|
+
* fixing sig for addrinfo ([#2464](https://github.com/ruby/rbs/pull/2464))
|
|
100
|
+
|
|
101
|
+
### Language updates
|
|
102
|
+
|
|
103
|
+
* Add type arguments support to singleton types ([#2502](https://github.com/ruby/rbs/pull/2502))
|
|
104
|
+
* Move the note about lower bound ([#2517](https://github.com/ruby/rbs/pull/2517))
|
|
105
|
+
* Add support for lower bounds in type parameters ([#2490](https://github.com/ruby/rbs/pull/2490))
|
|
106
|
+
|
|
107
|
+
### Library changes
|
|
108
|
+
|
|
109
|
+
* Add `#type_fingerprint` methods ([#2879](https://github.com/ruby/rbs/pull/2879))
|
|
110
|
+
* `top` for membership predicates of collection types ([#2878](https://github.com/ruby/rbs/pull/2878))
|
|
111
|
+
* Add block parameter (`&block`) type declaration ([#2875](https://github.com/ruby/rbs/pull/2875))
|
|
112
|
+
* Add splat (`*a`) and double-splat (`**a`) parameter support ([#2873](https://github.com/ruby/rbs/pull/2873))
|
|
113
|
+
* Add parameter type inline annotation ([#2443](https://github.com/ruby/rbs/pull/2443))
|
|
114
|
+
* Reduce compile warnings ([#2871](https://github.com/ruby/rbs/pull/2871))
|
|
115
|
+
* Specify input range by byte offsets ([#2863](https://github.com/ruby/rbs/pull/2863))
|
|
116
|
+
* add `extern "C"` wrapping to `rbs.h` when using C++ ([#2855](https://github.com/ruby/rbs/pull/2855))
|
|
117
|
+
* Automatically inherits super method type if unannotated ([#2858](https://github.com/ruby/rbs/pull/2858))
|
|
118
|
+
* Add `...` syntax to method type inline annotation syntax ([#2856](https://github.com/ruby/rbs/pull/2856))
|
|
119
|
+
* Fix for string reference corruption issue ([#2836](https://github.com/ruby/rbs/pull/2836))
|
|
120
|
+
* Use unreleased steep for `rake typecheck_test` ([#2842](https://github.com/ruby/rbs/pull/2842))
|
|
121
|
+
* Fix breaking references after GC.compact ([#2822](https://github.com/ruby/rbs/pull/2822))
|
|
122
|
+
* Fix special methods accessibility. ([#2546](https://github.com/ruby/rbs/pull/2546))
|
|
123
|
+
* Fix allocation alignment ([#2788](https://github.com/ruby/rbs/pull/2788))
|
|
124
|
+
* Skip `set` and `pathname` from `manifest.yaml` ([#2773](https://github.com/ruby/rbs/pull/2773))
|
|
125
|
+
* Fix C++ compiler warnings ([#2755](https://github.com/ruby/rbs/pull/2755))
|
|
126
|
+
* Better encoding ([#2675](https://github.com/ruby/rbs/pull/2675))
|
|
127
|
+
* Move `require_eof` handling to C API ([#2678](https://github.com/ruby/rbs/pull/2678))
|
|
128
|
+
* Delete debug print ([#2753](https://github.com/ruby/rbs/pull/2753))
|
|
129
|
+
* Make assertions macro ([#2729](https://github.com/ruby/rbs/pull/2729))
|
|
130
|
+
* Remove deprecated method `Kernel#Namespace`. Also remove `Kernel#TypeName`. ([#2480](https://github.com/ruby/rbs/pull/2480))
|
|
131
|
+
* Update rdoc to 6.13.1 ([#2355](https://github.com/ruby/rbs/pull/2355))
|
|
132
|
+
* Allow `self` for inline `@rbs @ivar: self` ([#2633](https://github.com/ruby/rbs/pull/2633))
|
|
133
|
+
* Normalize modules during type name resolution ([#2670](https://github.com/ruby/rbs/pull/2670))
|
|
134
|
+
* Only load extconf_compile_commands_json when compiling through Rake ([#2498](https://github.com/ruby/rbs/pull/2498))
|
|
135
|
+
* Use `malloc` based allocator ([#2666](https://github.com/ruby/rbs/pull/2666))
|
|
136
|
+
* Add another parser benchmark script ([#2668](https://github.com/ruby/rbs/pull/2668))
|
|
137
|
+
* Reuse empty array and hash ([#2667](https://github.com/ruby/rbs/pull/2667))
|
|
138
|
+
* Faster lexical analyzer ([#2665](https://github.com/ruby/rbs/pull/2665))
|
|
139
|
+
* Introduce `type_fingerprint` ([#2644](https://github.com/ruby/rbs/pull/2644))
|
|
140
|
+
* Add module-class alias declaration ([#2636](https://github.com/ruby/rbs/pull/2636))
|
|
141
|
+
* Inline constant declaration ([#2635](https://github.com/ruby/rbs/pull/2635))
|
|
142
|
+
* `self` type is rejected depending on the context ([#2627](https://github.com/ruby/rbs/pull/2627))
|
|
143
|
+
* Add instance variable declaration annotation ([#2632](https://github.com/ruby/rbs/pull/2632))
|
|
144
|
+
* Module-self allow void once ([#2626](https://github.com/ruby/rbs/pull/2626))
|
|
145
|
+
* Support inheritance in Inline RBS declaration ([#2630](https://github.com/ruby/rbs/pull/2630))
|
|
146
|
+
* Inline attribute/method definitions have comments ([#2624](https://github.com/ruby/rbs/pull/2624))
|
|
147
|
+
* Inline RBS declaration for attributes (`attr_***`) ([#2623](https://github.com/ruby/rbs/pull/2623))
|
|
148
|
+
* Fix bad scaling in `rbs_comment_t` tokens ([#2578](https://github.com/ruby/rbs/pull/2578))
|
|
149
|
+
* Update parser so that `void` type is rejected depending on the context ([#2590](https://github.com/ruby/rbs/pull/2590))
|
|
150
|
+
* Implement mixin in inline RBS declarations ([#2614](https://github.com/ruby/rbs/pull/2614))
|
|
151
|
+
* Validate type args given to non-generic ancestor ([#2615](https://github.com/ruby/rbs/pull/2615))
|
|
152
|
+
* Add name locations to AST ([#2595](https://github.com/ruby/rbs/pull/2595))
|
|
153
|
+
* Move `exit` calls to `exe/rbs` ([#2591](https://github.com/ruby/rbs/pull/2591))
|
|
154
|
+
* Fix locator ([#2588](https://github.com/ruby/rbs/pull/2588))
|
|
155
|
+
* Introduce standalone C parser for RBS with arena allocation ([#2398](https://github.com/ruby/rbs/pull/2398))
|
|
156
|
+
* Fix subtraction of civar ([#2369](https://github.com/ruby/rbs/pull/2369))
|
|
157
|
+
* Buffer with empty string ([#2551](https://github.com/ruby/rbs/pull/2551))
|
|
158
|
+
* Fix unavailable MAP_ANONYMOUS ([#2470](https://github.com/ruby/rbs/pull/2470))
|
|
159
|
+
* Inline minor fix ([#2514](https://github.com/ruby/rbs/pull/2514))
|
|
160
|
+
* Enable `-Wc++-compat` ([#2463](https://github.com/ruby/rbs/pull/2463))
|
|
161
|
+
* Expose a method to parse type parameters ([#2457](https://github.com/ruby/rbs/pull/2457))
|
|
162
|
+
* Expose and fix `Block#location` ([#2456](https://github.com/ruby/rbs/pull/2456))
|
|
163
|
+
* Restore RBS::Environment#declarations for backwards-compatibility ([#2393](https://github.com/ruby/rbs/pull/2393))
|
|
164
|
+
* Implement `@rbs return: T` annotation ([#2406](https://github.com/ruby/rbs/pull/2406))
|
|
165
|
+
* Add `@rbs skip` annotation ([#2405](https://github.com/ruby/rbs/pull/2405))
|
|
166
|
+
* Inline annotations ([#2403](https://github.com/ruby/rbs/pull/2403))
|
|
167
|
+
* Inline `def` support ([#2392](https://github.com/ruby/rbs/pull/2392))
|
|
168
|
+
* Suppress to GCC warning with multi-line comment ([#2383](https://github.com/ruby/rbs/pull/2383))
|
|
169
|
+
* Add inline class/module declaration ([#2390](https://github.com/ruby/rbs/pull/2390))
|
|
170
|
+
* Add `RBS::Source::RBS` ([#2380](https://github.com/ruby/rbs/pull/2380))
|
|
171
|
+
|
|
172
|
+
#### rbs prototype
|
|
173
|
+
|
|
174
|
+
* [prototype runtime] Find redefined methods ([#2542](https://github.com/ruby/rbs/pull/2542))
|
|
175
|
+
|
|
176
|
+
#### rbs collection
|
|
177
|
+
|
|
178
|
+
### Miscellaneous
|
|
179
|
+
|
|
180
|
+
* bundle update (2026-01-20) ([#2818](https://github.com/ruby/rbs/pull/2818))
|
|
181
|
+
* Ruby 4.0.1 ([#2823](https://github.com/ruby/rbs/pull/2823))
|
|
182
|
+
* [rbs/test] Check type arguments size ([#2809](https://github.com/ruby/rbs/pull/2809))
|
|
183
|
+
* Add tsort to testing dependencies ([#2795](https://github.com/ruby/rbs/pull/2795))
|
|
184
|
+
* Update ruby to 4.0 ([#2776](https://github.com/ruby/rbs/pull/2776))
|
|
185
|
+
* Ruby 4.0.0 preview3 ([#2764](https://github.com/ruby/rbs/pull/2764))
|
|
186
|
+
* Remove test code for bundled gems ([#2760](https://github.com/ruby/rbs/pull/2760))
|
|
187
|
+
* Fix `nil` size `Enumerator` test ([#2749](https://github.com/ruby/rbs/pull/2749))
|
|
188
|
+
* Fix tests for rbs_skip_tests in ruby repo ([#2725](https://github.com/ruby/rbs/pull/2725))
|
|
189
|
+
* Update rdoc to v6.16 ([#2721](https://github.com/ruby/rbs/pull/2721))
|
|
190
|
+
* Run CI with "4.0.0-preview2" ([#2718](https://github.com/ruby/rbs/pull/2718))
|
|
191
|
+
* Minor typo fix ([#2676](https://github.com/ruby/rbs/pull/2676))
|
|
192
|
+
* Add -j option to make ([#2658](https://github.com/ruby/rbs/pull/2658))
|
|
193
|
+
* Allows the use of a path list as RBS_SKIP_TESTS ([#2612](https://github.com/ruby/rbs/pull/2612))
|
|
194
|
+
* Fix clang-format ([#2589](https://github.com/ruby/rbs/pull/2589))
|
|
195
|
+
* Restrict the execution of the valgrind task to when the C code has been modified. ([#2552](https://github.com/ruby/rbs/pull/2552))
|
|
196
|
+
* Set force_ruby_platform for bundler when head ([#2555](https://github.com/ruby/rbs/pull/2555))
|
|
197
|
+
* More skip paths with valgrind ([#2557](https://github.com/ruby/rbs/pull/2557))
|
|
198
|
+
* Run the `Encoding::Converter` test ([#2550](https://github.com/ruby/rbs/pull/2550))
|
|
199
|
+
* Fix CI ([#2527](https://github.com/ruby/rbs/pull/2527))
|
|
200
|
+
* Replace reference with official documentation ([#2453](https://github.com/ruby/rbs/pull/2453))
|
|
201
|
+
* Add clangd integration for improved C extension development ([#2481](https://github.com/ruby/rbs/pull/2481))
|
|
202
|
+
* Setup clang format for C code ([#2437](https://github.com/ruby/rbs/pull/2437))
|
|
203
|
+
* Add `super` calls in `setup` ([#2484](https://github.com/ruby/rbs/pull/2484))
|
|
204
|
+
* Suppress warnings during testing ([#2370](https://github.com/ruby/rbs/pull/2370))
|
|
205
|
+
* Update rubocop-on-rbs and use plugins ([#2345](https://github.com/ruby/rbs/pull/2345))
|
|
206
|
+
* Fix error at Ruby CI ([#2445](https://github.com/ruby/rbs/pull/2445))
|
|
207
|
+
* Use `erb` instead of `set` for load path testing ([#2439](https://github.com/ruby/rbs/pull/2439))
|
|
208
|
+
* Skip loading ruby_memcheck ([#2349](https://github.com/ruby/rbs/pull/2349))
|
|
209
|
+
* Forcibly uninstall gems even if there is a dependency problem. ([#2346](https://github.com/ruby/rbs/pull/2346))
|
|
210
|
+
|
|
211
|
+
## 3.10.3 (2026-01-30)
|
|
212
|
+
|
|
213
|
+
This is a minor fix around the dependency to `tsort`.
|
|
214
|
+
|
|
215
|
+
## Pull Requests
|
|
216
|
+
|
|
217
|
+
* Merge pull request #2601 from ima1zumi/add-tsort-dep ([#2834](https://github.com/ruby/rbs/pull/2834))
|
|
218
|
+
|
|
219
|
+
## 3.10.2 (2026-01-07)
|
|
220
|
+
|
|
221
|
+
This is a minor fix on arena allocator alignment.
|
|
222
|
+
|
|
223
|
+
### Pull Requests
|
|
224
|
+
|
|
225
|
+
* Merge pull request #2788 from ruby/fix-alloc-alignment ([#2790](https://github.com/ruby/rbs/pull/2790))
|
|
226
|
+
|
|
227
|
+
## 3.10.1 (2026-01-07)
|
|
228
|
+
|
|
229
|
+
This is a follow-up release for Ruby 4.0.0 with documentation update based on Ruby 4.0.0, and bugfixes related to set/pathname library loading.
|
|
230
|
+
|
|
231
|
+
### Pull Requests
|
|
232
|
+
|
|
233
|
+
* Merge pull request #2777 from ksss/pathname-ext ([#2786](https://github.com/ruby/rbs/pull/2786))
|
|
234
|
+
* Ruby 4.0.0 backports ([#2785](https://github.com/ruby/rbs/pull/2785))
|
|
235
|
+
* [Backport] Fix subtraction of civar ([#2783](https://github.com/ruby/rbs/pull/2783))
|
|
236
|
+
* [Backport] Update ruby to 4.0 ([#2778](https://github.com/ruby/rbs/pull/2778))
|
|
237
|
+
|
|
238
|
+
## 3.10.0 (2025-12-23)
|
|
239
|
+
|
|
240
|
+
RBS 3.10.0 ships with a pure C parser implementation, signature updates for Ruby 4.0, and various bug fixes.
|
|
241
|
+
|
|
242
|
+
### Pure C parser implementation
|
|
243
|
+
|
|
244
|
+
The new parser implementation was announced at [RubyKaigi 2025](https://rubykaigi.org/2025/presentations/amomchilov.html) and is finally shipped as a RubyGem!
|
|
245
|
+
|
|
246
|
+
The new parser is faster than the one in 3.9 and is portable — it is independent of the Ruby runtime and is used to implement Sorbet’s RBS support.
|
|
247
|
+
|
|
248
|
+
### Type definition of bundled gems
|
|
249
|
+
|
|
250
|
+
The type definitions of `cgi` have been moved to [gem_rbs_collection](https://github.com/ruby/gem_rbs_collection/tree/main/gems/cgi), as it has been migrated to a bundled gem in Ruby 4.0
|
|
251
|
+
|
|
252
|
+
`cgi-escape` has been added to `stdlib`. You may need to declare a dependency on `cgi-escape` in your `manifest.yaml`, add `-r cgi-escape` to your command line, or update your type checker configuration.
|
|
253
|
+
|
|
254
|
+
```yaml
|
|
255
|
+
dependencies:
|
|
256
|
+
- name: cgi-escape
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
The type definitions for `pathname` have also been moved from `stdlib` to `core`, as it is now implemented as part of the core library.
|
|
260
|
+
|
|
261
|
+
### Pull Requests
|
|
262
|
+
|
|
263
|
+
* [Backport] Support rdoc v7 ([#2770](https://github.com/ruby/rbs/pull/2770))
|
|
264
|
+
* [Backport] Check tuple type length ([#2766](https://github.com/ruby/rbs/pull/2766))
|
|
265
|
+
* Backport update to 4.0.0-preview3 ([#2768](https://github.com/ruby/rbs/pull/2768))
|
|
266
|
+
* [Backport] Remove test code for bundled gems ([#2762](https://github.com/ruby/rbs/pull/2762))
|
|
267
|
+
* Merge pull request #2761 from ruby/update-minitest ([#2763](https://github.com/ruby/rbs/pull/2763))
|
|
268
|
+
* [Backport] Support BigDecimal v4 ([#2759](https://github.com/ruby/rbs/pull/2759))
|
|
269
|
+
* Parser/lexer backports ([#2756](https://github.com/ruby/rbs/pull/2756))
|
|
270
|
+
* Merge pull request #2753 from ruby/delete-printf ([#2754](https://github.com/ruby/rbs/pull/2754))
|
|
271
|
+
* Backports ([#2751](https://github.com/ruby/rbs/pull/2751))
|
|
272
|
+
* Merge pull request #2728 from ruby/cgi ([#2747](https://github.com/ruby/rbs/pull/2747))
|
|
273
|
+
* Merge pull request #2729 from ruby/rbs-assert ([#2748](https://github.com/ruby/rbs/pull/2748))
|
|
274
|
+
* Merge pull request #2749 from ruby/fix-test ([#2750](https://github.com/ruby/rbs/pull/2750))
|
|
275
|
+
* Backport RBS file updates ([#2742](https://github.com/ruby/rbs/pull/2742))
|
|
276
|
+
* Backport JSON PRs ([#2740](https://github.com/ruby/rbs/pull/2740))
|
|
277
|
+
* Merge pull request #2718 from ruby/ruby-4 ([#2741](https://github.com/ruby/rbs/pull/2741))
|
|
278
|
+
* [Backport] Move Pathname to core from stdlib ([#2730](https://github.com/ruby/rbs/pull/2730))
|
|
279
|
+
* Backport rdoc 6.16 ([#2722](https://github.com/ruby/rbs/pull/2722))
|
|
280
|
+
* Backport rdoc support ([#2719](https://github.com/ruby/rbs/pull/2719))
|
|
281
|
+
* Backport "Remove sig for IO#{ready?,nread}" ([#2720](https://github.com/ruby/rbs/pull/2720))
|
|
282
|
+
* Backport more pure C parsers ([#2679](https://github.com/ruby/rbs/pull/2679))
|
|
283
|
+
* Backport module name normalization ([#2673](https://github.com/ruby/rbs/pull/2673))
|
|
284
|
+
* Backport pure-C parser ([#2671](https://github.com/ruby/rbs/pull/2671))
|
|
285
|
+
* Fix test failure ([#2672](https://github.com/ruby/rbs/pull/2672))
|
|
286
|
+
|
|
3
287
|
## 3.9.5 (2025-09-08)
|
|
4
288
|
|
|
5
289
|
### Signature updates
|
data/README.md
CHANGED
|
@@ -141,7 +141,7 @@ require "rbs"
|
|
|
141
141
|
loader = RBS::EnvironmentLoader.new()
|
|
142
142
|
|
|
143
143
|
# loader.add(path: Pathname("sig")) # Load .rbs files from `sig` directory
|
|
144
|
-
# loader.add(library: "
|
|
144
|
+
# loader.add(library: "logger") # Load logger library
|
|
145
145
|
|
|
146
146
|
environment = RBS::Environment.from_loader(loader).resolve_type_names
|
|
147
147
|
|
|
@@ -198,6 +198,43 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
|
198
198
|
|
|
199
199
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
200
200
|
|
|
201
|
+
### C Code Formatting
|
|
202
|
+
|
|
203
|
+
This project uses `clang-format` to enforce consistent formatting of C code with a `.clang-format` configuration in the root directory.
|
|
204
|
+
|
|
205
|
+
#### Setup
|
|
206
|
+
|
|
207
|
+
First, install clang-format:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# macOS
|
|
211
|
+
brew install clang-format
|
|
212
|
+
|
|
213
|
+
# Ubuntu/Debian
|
|
214
|
+
sudo apt-get install clang-format
|
|
215
|
+
|
|
216
|
+
# Windows
|
|
217
|
+
choco install llvm
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
#### Usage
|
|
221
|
+
|
|
222
|
+
Format all C source files:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
rake format:c
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Check formatting without making changes:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
rake format:c_check
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
#### Editor Integration
|
|
235
|
+
|
|
236
|
+
For VS Code users, install the "clangd" extension which will automatically use the project's `.clang-format` file.
|
|
237
|
+
|
|
201
238
|
## Contributing
|
|
202
239
|
|
|
203
240
|
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/rbs.
|
data/Rakefile
CHANGED
|
@@ -11,37 +11,40 @@ bin = File.join(__dir__, "bin")
|
|
|
11
11
|
|
|
12
12
|
Rake::ExtensionTask.new("rbs_extension")
|
|
13
13
|
|
|
14
|
+
compile_task = Rake::Task[:compile]
|
|
15
|
+
|
|
16
|
+
task :setup_extconf_compile_commands_json do
|
|
17
|
+
ENV["COMPILE_COMMANDS_JSON"] = "1"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
compile_task.prerequisites.unshift(:setup_extconf_compile_commands_json)
|
|
21
|
+
|
|
14
22
|
test_config = lambda do |t|
|
|
15
23
|
t.libs << "test"
|
|
16
24
|
t.libs << "lib"
|
|
17
25
|
t.test_files = FileList["test/**/*_test.rb"].reject do |path|
|
|
18
26
|
path =~ %r{test/stdlib/}
|
|
19
27
|
end
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
unless Gem.win_platform?
|
|
25
|
-
begin
|
|
26
|
-
require "ruby_memcheck"
|
|
27
|
-
|
|
28
|
-
namespace :test do
|
|
29
|
-
RubyMemcheck::TestTask.new(valgrind: :compile, &test_config)
|
|
28
|
+
if defined?(RubyMemcheck)
|
|
29
|
+
if t.is_a?(RubyMemcheck::TestTask)
|
|
30
|
+
t.verbose = true
|
|
31
|
+
t.options = '-v'
|
|
30
32
|
end
|
|
31
|
-
rescue LoadError => exn
|
|
32
|
-
STDERR.puts "🚨🚨🚨🚨 Skipping RubyMemcheck: #{exn.inspect} 🚨🚨🚨🚨"
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
Rake::TestTask.new(test: :compile, &test_config)
|
|
37
|
+
|
|
36
38
|
multitask :default => [:test, :stdlib_test, :typecheck_test, :rubocop, :validate, :test_doc]
|
|
37
39
|
|
|
38
40
|
task :lexer do
|
|
39
|
-
sh "re2c -W --no-generation-date -o
|
|
41
|
+
sh "re2c -W --no-generation-date -o src/lexer.c src/lexer.re"
|
|
42
|
+
sh "clang-format -i -style=file src/lexer.c"
|
|
40
43
|
end
|
|
41
44
|
|
|
42
45
|
task :confirm_lexer => :lexer do
|
|
43
46
|
puts "Testing if lexer.c is updated with respect to lexer.re"
|
|
44
|
-
sh "git diff --exit-code
|
|
47
|
+
sh "git diff --exit-code src/lexer.c"
|
|
45
48
|
end
|
|
46
49
|
|
|
47
50
|
task :confirm_templates => :templates do
|
|
@@ -49,6 +52,84 @@ task :confirm_templates => :templates do
|
|
|
49
52
|
sh "git diff --exit-code -- include src"
|
|
50
53
|
end
|
|
51
54
|
|
|
55
|
+
# Task to format C code using clang-format
|
|
56
|
+
namespace :format do
|
|
57
|
+
dirs = ["src", "ext", "include"]
|
|
58
|
+
|
|
59
|
+
# Find all C source and header files
|
|
60
|
+
files = `find #{dirs.join(" ")} -type f \\( -name "*.c" -o -name "*.h" \\)`.split("\n")
|
|
61
|
+
|
|
62
|
+
desc "Format C source files using clang-format"
|
|
63
|
+
task :c do
|
|
64
|
+
puts "Formatting C files..."
|
|
65
|
+
|
|
66
|
+
# Check if clang-format is installed
|
|
67
|
+
unless system("which clang-format > /dev/null 2>&1")
|
|
68
|
+
abort "Error: clang-format not found. Please install clang-format first."
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
if files.empty?
|
|
72
|
+
puts "No C files found to format"
|
|
73
|
+
next
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
puts "Found #{files.length} files to format (excluding generated files)"
|
|
77
|
+
|
|
78
|
+
exit_status = 0
|
|
79
|
+
files.each do |file|
|
|
80
|
+
puts "Formatting #{file}"
|
|
81
|
+
unless system("clang-format -i -style=file #{file}")
|
|
82
|
+
puts "❌ Error formatting #{file}"
|
|
83
|
+
exit_status = 1
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
exit exit_status unless exit_status == 0
|
|
88
|
+
puts "✅ All files formatted successfully"
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
desc "Check if C source files are properly formatted"
|
|
92
|
+
task :c_check do
|
|
93
|
+
puts "Checking C file formatting..."
|
|
94
|
+
|
|
95
|
+
# Check if clang-format is installed
|
|
96
|
+
unless system("which clang-format > /dev/null 2>&1")
|
|
97
|
+
abort "Error: clang-format not found. Please install clang-format first."
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if files.empty?
|
|
101
|
+
puts "No C files found to check"
|
|
102
|
+
next
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
puts "Found #{files.length} files to check (excluding generated files)"
|
|
106
|
+
|
|
107
|
+
needs_format = false
|
|
108
|
+
files.each do |file|
|
|
109
|
+
formatted = `clang-format -style=file #{file}`
|
|
110
|
+
original = File.read(file)
|
|
111
|
+
|
|
112
|
+
if formatted != original
|
|
113
|
+
puts "❌ #{file} needs formatting"
|
|
114
|
+
puts "Diff:"
|
|
115
|
+
# Save formatted version to temp file and run diff
|
|
116
|
+
temp_file = "#{file}.formatted"
|
|
117
|
+
File.write(temp_file, formatted)
|
|
118
|
+
system("diff -u #{file} #{temp_file}")
|
|
119
|
+
File.unlink(temp_file)
|
|
120
|
+
needs_format = true
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if needs_format
|
|
125
|
+
warn "Some files need formatting. Run 'rake format:c' to format them."
|
|
126
|
+
exit 1
|
|
127
|
+
else
|
|
128
|
+
puts "✅ All files are properly formatted"
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
52
133
|
rule ".c" => ".re" do |t|
|
|
53
134
|
puts "⚠️⚠️⚠️ #{t.name} is older than #{t.source}. You may need to run `rake lexer` ⚠️⚠️⚠️"
|
|
54
135
|
end
|
|
@@ -70,17 +151,22 @@ task :confirm_annotation do
|
|
|
70
151
|
end
|
|
71
152
|
|
|
72
153
|
task :templates do
|
|
73
|
-
sh "#{ruby} templates/template.rb
|
|
74
|
-
sh "#{ruby} templates/template.rb
|
|
75
|
-
|
|
76
|
-
sh "#{ruby} templates/template.rb
|
|
154
|
+
sh "#{ruby} templates/template.rb ext/rbs_extension/ast_translation.h"
|
|
155
|
+
sh "#{ruby} templates/template.rb ext/rbs_extension/ast_translation.c"
|
|
156
|
+
|
|
157
|
+
sh "#{ruby} templates/template.rb ext/rbs_extension/class_constants.h"
|
|
158
|
+
sh "#{ruby} templates/template.rb ext/rbs_extension/class_constants.c"
|
|
159
|
+
|
|
160
|
+
sh "#{ruby} templates/template.rb include/rbs/ast.h"
|
|
161
|
+
sh "#{ruby} templates/template.rb src/ast.c"
|
|
162
|
+
|
|
163
|
+
# Format the generated files
|
|
164
|
+
Rake::Task["format:c"].invoke
|
|
77
165
|
end
|
|
78
166
|
|
|
79
|
-
task :compile => "ext/rbs_extension/
|
|
80
|
-
task :compile => "
|
|
81
|
-
task :compile => "
|
|
82
|
-
task :compile => "src/constants.c"
|
|
83
|
-
task :compile => "src/ruby_objs.c"
|
|
167
|
+
task :compile => "ext/rbs_extension/class_constants.h"
|
|
168
|
+
task :compile => "ext/rbs_extension/class_constants.c"
|
|
169
|
+
task :compile => "src/lexer.c"
|
|
84
170
|
|
|
85
171
|
task :test_doc do
|
|
86
172
|
files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
@@ -93,7 +179,7 @@ end
|
|
|
93
179
|
task :validate => :compile do
|
|
94
180
|
require 'yaml'
|
|
95
181
|
|
|
96
|
-
sh "#{ruby} #{rbs} validate
|
|
182
|
+
sh "#{ruby} #{rbs} validate"
|
|
97
183
|
|
|
98
184
|
libs = FileList["stdlib/*"].map {|path| File.basename(path).to_s }
|
|
99
185
|
|
|
@@ -114,7 +200,14 @@ task :validate => :compile do
|
|
|
114
200
|
end
|
|
115
201
|
|
|
116
202
|
libs.each do |lib|
|
|
117
|
-
|
|
203
|
+
args = ["-r", lib]
|
|
204
|
+
|
|
205
|
+
if lib == "rbs"
|
|
206
|
+
args << "-r"
|
|
207
|
+
args << "prism"
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
sh "#{ruby} #{rbs} #{args.join(' ')} validate"
|
|
118
211
|
end
|
|
119
212
|
end
|
|
120
213
|
|
|
@@ -126,7 +219,7 @@ end
|
|
|
126
219
|
|
|
127
220
|
task :stdlib_test => :compile do
|
|
128
221
|
test_files = FileList["test/stdlib/**/*_test.rb"].reject do |path|
|
|
129
|
-
path =~ %r{Ractor} || path =~ %r{Encoding} || path =~ %r{
|
|
222
|
+
path =~ %r{Ractor} || path =~ %r{Encoding} || path =~ %r{CGI-escape_test}
|
|
130
223
|
end
|
|
131
224
|
|
|
132
225
|
if ENV["RANDOMIZE_STDLIB_TEST_ORDER"] == "true"
|
|
@@ -135,7 +228,7 @@ task :stdlib_test => :compile do
|
|
|
135
228
|
|
|
136
229
|
sh "#{ruby} -Ilib #{bin}/test_runner.rb #{test_files.join(' ')}"
|
|
137
230
|
# TODO: Ractor tests need to be run in a separate process
|
|
138
|
-
sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/
|
|
231
|
+
sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/CGI-escape_test.rb"
|
|
139
232
|
sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/Ractor_test.rb"
|
|
140
233
|
sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/Encoding_test.rb"
|
|
141
234
|
end
|
|
@@ -228,7 +321,7 @@ namespace :generate do
|
|
|
228
321
|
class <%= target %>SingletonTest < Test::Unit::TestCase
|
|
229
322
|
include TestHelper
|
|
230
323
|
|
|
231
|
-
# library "
|
|
324
|
+
# library "logger", "securerandom" # Declare library signatures to load
|
|
232
325
|
testing "singleton(::<%= target %>)"
|
|
233
326
|
|
|
234
327
|
<%- class_methods.each do |method_name, definition| -%>
|
|
@@ -247,7 +340,7 @@ namespace :generate do
|
|
|
247
340
|
class <%= target %>Test < Test::Unit::TestCase
|
|
248
341
|
include TestHelper
|
|
249
342
|
|
|
250
|
-
# library "
|
|
343
|
+
# library "logger", "securerandom" # Declare library signatures to load
|
|
251
344
|
testing "::<%= target %>"
|
|
252
345
|
|
|
253
346
|
<%- instance_methods.each do |method_name, definition| -%>
|
|
@@ -430,3 +523,25 @@ task :changelog do
|
|
|
430
523
|
puts " (🤑 There is no *unreleased* pull request associated to the milestone.)"
|
|
431
524
|
end
|
|
432
525
|
end
|
|
526
|
+
|
|
527
|
+
desc "Compile extension without C23 extensions"
|
|
528
|
+
task :compile_c99 do
|
|
529
|
+
ENV["TEST_NO_C23"] = "true"
|
|
530
|
+
Rake::Task[:"compile"].invoke
|
|
531
|
+
ensure
|
|
532
|
+
ENV.delete("TEST_NO_C23")
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
task :prepare_bench do
|
|
536
|
+
ENV.delete("DEBUG")
|
|
537
|
+
Rake::Task[:"clobber"].invoke
|
|
538
|
+
Rake::Task[:"templates"].invoke
|
|
539
|
+
Rake::Task[:"compile"].invoke
|
|
540
|
+
end
|
|
541
|
+
|
|
542
|
+
task :prepare_profiling do
|
|
543
|
+
ENV["DEBUG"] = "1"
|
|
544
|
+
Rake::Task[:"clobber"].invoke
|
|
545
|
+
Rake::Task[:"templates"].invoke
|
|
546
|
+
Rake::Task[:"compile"].invoke
|
|
547
|
+
end
|
data/Steepfile
CHANGED
|
@@ -9,11 +9,13 @@ target :lib do
|
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
library "pathname", "json", "logger", "monitor", "tsort", "uri", 'dbm', 'pstore', 'singleton', 'shellwords', 'fileutils', 'find', 'digest', 'prettyprint', 'yaml', "psych", "securerandom"
|
|
12
|
+
library "prism"
|
|
12
13
|
signature "stdlib/strscan/0/"
|
|
13
14
|
signature "stdlib/optparse/0/"
|
|
14
15
|
signature "stdlib/rdoc/0/"
|
|
15
16
|
signature "stdlib/ripper/0"
|
|
16
17
|
signature "stdlib/pp/0"
|
|
18
|
+
signature "steep/patch.rbs"
|
|
17
19
|
|
|
18
20
|
# configure_code_diagnostics do |config|
|
|
19
21
|
# config[D::Ruby::MethodDefinitionMissing] = :hint
|