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)
- Use unreleased steep for
rake typecheck_test(#2842) - Fix breaking references after GC.compact (#2822)
- Fix special methods accessibility. (#2546)
- Fix allocation alignment (#2788)
- Skip
setandpathnamefrommanifest.yaml(#2773) - Fix C++ compiler warnings (#2755)
- Better encoding (#2675)
- Move
require_eofhandling to C API (#2678) - Delete debug print (#2753)
- Make assertions macro (#2729)
- Remove deprecated method
Kernel#Namespace. Also removeKernel#TypeName. (#2480) - Update rdoc to 6.13.1 (#2355)
- Allow
selffor inline@rbs @ivar: self(#2633) - Normalize modules during type name resolution (#2670)
- Only load extconf_compile_commands_json when compiling through Rake (#2498)
- Use
mallocbased allocator (#2666) - Add another parser benchmark script (#2668)
- Reuse empty array and hash (#2667)
- Faster lexical analyzer (#2665)
- Introduce
type_fingerprint(#2644) - Add module-class alias declaration (#2636)
- Inline constant declaration (#2635)
selftype is rejected depending on the context (#2627)- Add instance variable declaration annotation (#2632)
- Module-self allow void once (#2626)
- Support inheritance in Inline RBS declaration (#2630)
- Inline attribute/method definitions have comments (#2624)
- Inline RBS declaration for attributes (
attr_***) (#2623) - Fix bad scaling in
rbs_comment_ttokens (#2578) - Update parser so that
voidtype is rejected depending on the context (#2590) - Implement mixin in inline RBS declarations (#2614)
- Validate type args given to non-generic ancestor (#2615)
- Add name locations to AST (#2595)
- Move
exitcalls toexe/rbs(#2591) - Fix locator (#2588)
- Introduce standalone C parser for RBS with arena allocation (#2398)
- Fix subtraction of civar (#2369)
- Buffer with empty string (#2551)
- Fix unavailable MAP_ANONYMOUS (#2470)
- Inline minor fix (#2514)
- Enable
-Wc++-compat(#2463) - Expose a method to parse type parameters (#2457)
- Expose and fix
Block#location(#2456) - Restore RBS::Environment#declarations for backwards-compatibility (#2393)
- Implement
@rbs return: Tannotation (#2406) - Add
@rbs skipannotation (#2405) - Inline annotations (#2403)
- Inline
defsupport (#2392) - Suppress to GCC warning with multi-line comment (#2383)
- Add inline class/module declaration (#2390)
- Add
RBS::Source::RBS(#2380)
rbs prototype
- [prototype runtime] Find redefined methods (#2542)
rbs collection
Miscellaneous
- bundle update (2026-01-20) (#2818)
- Ruby 4.0.1 (#2823)
- [rbs/test] Check type arguments size (#2809)
- Add tsort to testing dependencies (#2795)
- Update ruby to 4.0 (#2776)
- Ruby 4.0.0 preview3 (#2764)
- Remove test code for bundled gems (#2760)
- Fix
nilsizeEnumeratortest (#2749) - Fix tests for rbs_skip_tests in ruby repo (#2725)
- Update rdoc to v6.16 (#2721)
- Run CI with "4.0.0-preview2" (#2718)
- Minor typo fix (#2676)
- Add -j option to make (#2658)
- Allows the use of a path list as RBS_SKIP_TESTS (#2612)
- Fix clang-format (#2589)
- Restrict the execution of the valgrind task to when the C code has been modified. (#2552)
- Set force_ruby_platform for bundler when head (#2555)
- More skip paths with valgrind (#2557)
- Run the
Encoding::Convertertest (#2550) - Fix CI (#2527)
- Replace reference with official documentation (#2453)
- Add clangd integration for improved C extension development (#2481)
- Setup clang format for C code (#2437)
- Add
supercalls insetup(#2484) - Suppress warnings during testing (#2370)
- Update rubocop-on-rbs and use plugins (#2345)
- Fix error at Ruby CI (#2445)
- Use
erbinstead ofsetfor load path testing (#2439) - Skip loading ruby_memcheck (#2349)
- Forcibly uninstall gems even if there is a dependency problem. (#2346)