Releases: ruby/rbs
4.0.2
3.10.4
4.0.0
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 for the syntax details.
class Calculator
# @rbs (Integer, Integer) -> Integer
def add(a, b) = a + b
endNote: RBS inline is still experimental and may change in future releases.
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).
Signature updates
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
- Remove deprecated types (#2880)
- Add type
RBS::Unnamed::TopLevelSelfClassto core (#2362) - Graduate bundled gems from Ruby v4.0 (#2852)
- stdlib: Add missing Psych methods and exception classes (#2850)
- Add variants with positional argument to
Hash#transform_keys(#2848) - add extra kwarg options for File#initialize and derivatives (#2798)
- pstore: fixes types, treat it as a collection (#2806)
- Add signatures for
{Module,Proc}#ruby2_keywords(#2805) - Make Zlib::GzipWriter.new level and strategy parameters optional (#2810)
- URI.(s) does string coercion (#2825)
- Fix String#append_as_bytes to accept Integer (#2817)
- [Comparable] Add in Comparable::_CompareToZero (#2697)
- [Kernel] Add Kernel.trace_var and Kernel.untrace_var (#2682)
- Add signature for
Module#method_undefined(#2804) - Fix Zlib::GzipWriter signatures (#2803)
- GzipWriter#initialize only takes 1 required positional arg (#2799)
- Fix accessibility of method in Module (#2802)
- Graduate kconv (#2794)
- Fix test related to pathname (#2789)
- Split pathname to core and stdlib (#2777)
- [Kernel] Narrow
caller_locations(#2745) - Ruby 4.1 changed
source_locationtype (#2784) - Remove ObjectSpace.count_nodes (#2779)
- Support selector for
String#stripfamily. (#2775) - Add
Ruby,Array#find, andArray#rfind(#2767) - Update minitest (#2761)
- Support BigDecimal v4 (#2758)
- Update rdoc and comments (#2733)
- Update cgi and cgi/escape type definitions (#2728)
- Update RBS files for Ruby 4 (#2731)
- Update existing docs (#2724)
- Remove reference to
JSON.deep_const_get(#2701) - Remove deprecated methods in
JSON(#2366) - Update FileUtils to v1.8.0 (#2700)
- Avoid overloading where arguments are identical (#2559)
- Move Pathname to core from stdlib (#2705)
- Remove undocumented
#nonzero?(#2543) - Add signature for
OptionParser#raise_unknown(#2735) - Add signature for
Open3.popen2(#2734) - Add RFC2396_PARSER to URI module (#2727)
- Add signature for
Open3.capture3(#2714) - Remove sig for IO#{ready?,nread} (#2710)
- Accept
nilstate parameter into_jsontype signatures (#2691) - Add type of
Open3.popen3(#2699) unsetenv_othersandclose_othersonly allows bool. (#2698)- Add deprecated annotation to
attrwith bool args (#2693) - Update open3 (#2692)
- Add signature for
SecureRandom.bytes(#2690) - Set %a{deprecated} to deprecated core methods (#2664)
- Migrate usages of ::_ToPath to use ::path instead (#2677)
- Add missing signatures for
Random::Formatter(#2680) - Split
Random::Formatterto core and stdlib (#2661) - Skip test cases of developing methods for Pathname (#2648)
- Add signature
Random.seed(#2649) - Update
string.rbsto avoid deprecation warning in Steep (#2655) - Add sig
IO#preadandIO#pwrite(#2647) - Refine signature of
Numeric#stepand add type ofEnumerator::ArithmeticSequence(#2600) - Remove undocumented override methods (#2622)
- Add docs (#2625)
- Remove undocumented methods for
imaginary(#2620) - Update securerandom (#2619)
- Drop undocumented
#eql?(#2618) - Just use
Numeric#+@and return self (#2597) - Drop undocumented
#dup(#2598) - Add signature for
Digest::SHA2(#2573) - Add signatures for
OpenURI(#2574) - Add signature for
IO::TimeoutError(#2571) - Add signatures for
Set(#2570) - Add signature for
Enumerator#+(#2567) - Add signature for
Enumerator::Lazy#eager(#2568) - Add signature for
Fiber#blocking(#2566) - Support BasicObject to avoid NoMethodError for
RBS::Test::TypeCheck(#2565) - Add documentation for
Range#{minmax,count,to_a,entries}(#2562) - Delegate to
EnumerablefromRange#{min,max}(#2540) - Add URI::Generic#+ (#2535)
- Make IO.binread, IO.binwrite, IO.read and IO.write accept _ToPath (#2378)
- Support pattern argument for Enumerable#{all,any,none,one}? (#2368)
- fixing sig for addrinfo (#2464)
Language updates
- Add type arguments support to singleton types (#2502)
- Move the note about lower bound (#2517)
- Add support for lower bounds in type parameters (#2490)
Library changes
- Add
#type_fingerprintmethods (#2879) topfor membership predicates of collection types (#2878)- Add block parameter (
&block) type declaration (#2875) - Add splat (
*a) and double-splat (**a) parameter support (#2873) - Add parameter type inline annotation (#2443)
- Reduce compile warnings (#2871)
- Specify input range by byte offsets (#2863)
- add
extern "C"wrapping torbs.hwhen using C++ (#2855) - Automatically inherits super method type if unannotated (#2858)
- Add
...syntax to method type inline annotation syntax (#2856) - Fix for string reference corruption issue ([#2836](https://github....
3.10.3
4.0.0.dev.5
3.10.2
3.10.1
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.
Pull Requests
3.10.0
RBS 3.10.0 ships with a pure C parser implementation, signature updates for Ruby 4.0, and various bug fixes.
Pure C parser implementation
The new parser implementation was announced at RubyKaigi 2025 and is finally shipped as a RubyGem!
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.
Type definition of bundled gems
The type definitions of cgi have been moved to gem_rbs_collection, as it has been migrated to a bundled gem in Ruby 4.0
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.
dependencies:
- name: cgi-escapeThe type definitions for pathname have also been moved from stdlib to core, as it is now implemented as part of the core library.
Pull Requests
- [Backport] Support rdoc v7 (#2770)
- [Backport] Check tuple type length (#2766)
- Backport update to 4.0.0-preview3 (#2768)
- [Backport] Remove test code for bundled gems (#2762)
- Merge pull request #2761 from ruby/update-minitest (#2763)
- [Backport] Support BigDecimal v4 (#2759)
- Parser/lexer backports (#2756)
- Merge pull request #2753 from ruby/delete-printf (#2754)
- Backports (#2751)
- Merge pull request #2728 from ruby/cgi (#2747)
- Merge pull request #2729 from ruby/rbs-assert (#2748)
- Merge pull request #2749 from ruby/fix-test (#2750)
- Backport RBS file updates (#2742)
- Backport JSON PRs (#2740)
- Merge pull request #2718 from ruby/ruby-4 (#2741)
- [Backport] Move Pathname to core from stdlib (#2730)
- Backport rdoc 6.16 (#2722)
- Backport rdoc support (#2719)
- Backport "Remove sig for IO#{ready?,nread}" (#2720)
- Backport more pure C parsers (#2679)
- Backport module name normalization (#2673)
- Backport pure-C parser (#2671)
- Fix test failure (#2672)