-
Notifications
You must be signed in to change notification settings - Fork 217
Release Note 3.3
Some of the highlights in RBS 3.3 are:
- Add
rbs diff
command (#1459) - Add
--todo
option torbs prototype runtime
(#1470, #1539) - Add
__todo__
type (#1520) - Additional syntactic validation with
rbs validate
(#1566) - Delete
sources:
section fromrbs_collection.lock.yaml
(#1544)
You can install it with $ gem install rbs
or using Bundler.
gem 'rbs', '~> 3.3.0'
Read the CHANGELOG for the details.
RBS 3.3 has many stdlib signature updates. Updating from 3.2 may cause having different type checking results.
rbs diff
helps understanding the changes between two sets of RBS type definitions.
$ bundle exec rbs --no-collection diff --format diff --type-name ActiveStorage::Attachment --before ../gem_rbs_collection/gems/activestorage/6.0 --after ../gem_rbs_collection/gems/activestorage/6.1
- def self.has_one_attached: (::String | ::Symbol name, ?dependent: ::Symbol dependent) -> void
+ def self.has_one_attached: (::String | ::Symbol name, ?dependent: ::Symbol dependent, ?service: ::String | ::Symbol | nil service, ?strict_loading: bool strict_loading) -> void
- def self.has_many_attached: (::String | ::Symbol name, ?dependent: ::Symbol dependent) -> void
+ def self.has_many_attached: (::String | ::Symbol name, ?dependent: ::Symbol dependent, ?service: ::String | ::Symbol | nil service, ?strict_loading: bool strict_loading) -> void
rbs prototype runtime
now accepts --todo
option, which generates only missing RBS declarations. It is useful to identify the Ruby implementation changes that is not included in the RBS files.
$ bundle exec rbs prototype runtime --todo IO
class IO
public
def external_encoding: () -> untyped
def pread: (*untyped) -> untyped
def pwrite: (untyped, untyped) -> untyped
def to_path: () -> untyped
def wait_priority: (*untyped) -> untyped
end
The printed RBS only contains methods that is not included in the currently loaded RBS definition.
RBS now has __todo__
type (#1520). It's equivalent to untyped
, but has different textual representation.
class Foo
attr_reader name: __todo__
end
You can use the type to mark something is work-in-progress.
#1566 implements additional type syntax validation through rbs validate
. It rejects some uses of void
, class
, instance
, self
types.
Foo: self # prohibited, self type cannot be used for constant types
Bar: void # prohibited, void type is only allowed at return types or generic parameters
The next version of RBS will report syntax error for these case. Make sure your type definition don't have these types with rbs validate
command.
rbs_collection.lock.yaml
won't include the sources:
section, which caused unintended diffs after rbs collection install
(#1544).
After running rbs collection install
with RBS 3.3, the sources:
section will be removed. Check in the updated file to your git repository, and you won't be bothered by the sources changes.