-
Notifications
You must be signed in to change notification settings - Fork 217
Release Note 3.6
Soutaro Matsumoto edited this page Oct 3, 2024
·
5 revisions
Some of the highlights in RBS 3.6 are:
- Generics improvements (#1994)
You can install it with $ gem install rbs
or using Bundler.
gem 'rbs', '~> 3.6.0'
Read the CHANGELOG for the details.
The upper bounds can be any type, not limited to class/module types, interface types, and singleton types.
interface _Foo[T < String?]
def foo: () -> T
end
type foo = _Foo[String] # OK
type bar = _Foo[Integer?] # Error
The generic type parameters can have default types.
interface _Each[Element, Return = void]
def each: { (Element) -> void } -> Return
end
type foo = _Each[Integer] # Equivalent to _Each[Integer, void]
The default types allows adding generic parameters without breaking compatibilities.