Skip to content

Release Note 2.8

Soutaro Matsumoto edited this page Jan 20, 2023 · 5 revisions

Some of the highlights in RBS 2.8 are:

  • Support to call collection command in child dir (#1025, #1135)
  • Make type/method-type parser more flexible about input position (#1140)

You can install it with $ gem install rbs or using Bundler.

gem 'rbs', '~> 2.8.0'

See the CHANGELOG for the details.

You can upgrade to RBS 2.8 from 2.7 safely.

Support to call collection command in child dir

rbs collection commands try to find rbs_collection.yaml and rbs_collection.lock.yaml in ancestor directories. The commands will use the inner-most rbs_collection.yaml, while Bundler users the top-most Gemfile from the ancestor directories.

The path to Gemfile.lock is also saved in the rbs_collection.lock.yaml to ensure the Bundler context is the same one as the one where lockfile is generated in.

Type/method-type parser can handle the middle of input

The RBS::Parser.parse_type and RBS::Parser.parse_method_type now accepts range: keyword, that specify where the parsing starts from and finishes at.

RBS::Parser.parse_type("() -> void () -> String", range: 6...10)   # Returns `void`
RBS::Parser.parse_type("() -> void () -> String", range: 6...)     # Returns `void` too

When range: is specified, the parser consumes one type/method-type and just returns, doesn't raises an error even if the input has more tokens other than EOF. You can use the new range: version to parse from the middle of the input and then continue processing the rest of the input.

When range: keyword is not given, it works as the previous version. It assumes all of the input is one type/method-type and raises an error if there is more token left.

Signature updates

New errors

  • RBS::InheritModuleError is added, which is raised if a class declaration inherits a module