github ruby/rbs v4.2.0
4.2.0

3 hours ago

Release note

RBS 4.2 accepts non-ASCII characters in identifiers. Method names, instance variable names and parameter names can be written in any script, and other names may contain non-ASCII characters as long as they start with an ASCII letter, which is what tells a constant from a method name.

class Greeter
  @挨拶: String

  def こんにちは: () -> String
end

The parser and the AST support Ruby-style ... forwarding parameters in method types, but the layers built on top of the parser do not yet. The syntax is disabled by default in 4.2 and is not enabled by the public RBS::Parser API, so it cannot be used in regular RBS signatures yet.

Ruby 3.2 reached EOL on 2026-04-01, and this release requires Ruby 3.3 or later. Applications on 3.2 stay on the 4.1 line.

Signature updates

Updated classes/modules/methods: ERB, ERB::DefMethod, IO, Monitor, MonitorMixin::ConditionVariable, Singleton, StringIO, Zlib::GzipFile, Zlib::GzipWriter

  • Replace deterministic untyped return types with concrete types (#2966)
  • Declare Singleton::SingletonInstanceMethods (#3037)

Language updates

  • Gate forwarding parameter syntax behind parser option (#3087)
  • Support non-ASCII identifiers (#3082)
  • Support forwarding parameters in method types (#3042)

Library changes

  • Drop runtime support for Ruby 3.2 (#3095)
  • Stop the lexer reading past the end of a byte_range (#3040)
  • Exclude CR from comment tokens to fix an off-by-one Location#end_line on CRLF files (#3069)
  • Handle the NULL parser in the WebAssembly shim (#3085)
  • Reject a byte position the lexer cannot start on (#3083)
  • Don't use Clang nullability qualifiers in strict ISO C mode (#3074)
  • Avoid eagerly inspecting call traces in type assertions (#3073)
  • Fix TypeParam.rename to substitute variables in bounds and default types (#3068)
  • Extract per-declaration type param alignment into entry-level align_params (#3070)
  • Align type params across declarations in module-self types and superclass validation (#3067)
  • Build the wasm module with -DNDEBUG (#3066)
  • Rename NODISCARD macro to RBS_NODISCARD (#3065)

Miscellaneous

  • Omit forwarding parameter tests on JRuby (#3092)
  • Skip JSON 2-only tests with JSON 3 (#3084)
  • Pin GitHub Actions to commit hashes (#3020)

Don't miss a new rbs release

NewReleases is sending notifications on new releases.