All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog.
- Updated Commander dependency to 5.0, to remove
abbrev
deprecation warning. As a result, the minimum supported Ruby version is now 3.0.
- Parsed method definitions can now have a modifier before the
def
keyword.
- Use
File#exist?
instead ofFile#exists?
in CLI, fixing an exception on Ruby 3.2.0. - Resolved incorrect code generation for
T::Enum
s with only one variant.
- The parser now loads untyped methods named
initialize
as returningvoid
, rather thanuntyped
. Potentially breaking if you are relying on this behaviour, though Sorbet now considers this an error.
#describe
now uses a new, clearer format.- Added
#describe_tree
, which produces#describe
output for a node and all of its children. - Added
#find
and#find_all
for retrieving a node's children based on criteria.
- Parlour now uses the new block-based
type_member
syntax internally. Potentially breaking if you pin an older version of Sorbet which doesn't support this syntax! - Improved error message when unable to retrieve the file table from Sorbet.
#inspect
and#to_s
now call#describe
.
- Fixed some incorrect YARD documentation tags.
- Disabled runtime type checking for
TypedObject#name
, resulting in a significant decrease in the time taken to run the conflict resolver.
- The RBI previously included with the Parlour gem has been removed, as it was causing issues with Sorbet. If you were relying on Parlour's bundled RBI while type-checking your project, you will now need to use the RBI from sorbet-typed or the Parlour repo.
Namespace#path
will now work much more reliably for classes and modules which replace methods fromModule
andClass
, such as#name
.
- Added RBS generation support! This includes:
- The new
RbsGenerator
class RbsObject
and a set of subclasses representing different RBS components- Note: RBS does not yet support Parlour plugins and some other features. Refer to the README for a full breakdown!
- The new
- Added the
Types
module, which is used to describe types agnostic of the underlying type system- Added
RbiGenerator::Namespace#generalize_from_rbi!
to convert RBI string types intoTypes
types - Specifying types as strings is still currently supported, but may be phased out in future, and should be avoided in new projects.
- Added
- Added conversion from RBI to RBS type trees
- Added a couple of classes to deduplicate functionality between type systems:
TypedObject
, whichRbiObject
andRbsObject
both inherit fromGenerator
, whichRbiGenerator
andRbsGenerator
both inherit from
- Added RBI type aliases
- Added
sealed!
for RBI namespaces - Added
abstract!
for RBI modules
Parlour::RbiGenerator::Options
is nowParlour::Options
. An alias exists for now, butParlour::RbiGenerator::Options
is deprecated and could be removed in future versions.- Updated README and gem metadata to refer to Parlour as a type information generator, rather than just an RBI generator
5.0.0 pre-releases
- Fixed collection types sometimes generating as
T::::Array
- Added
Types::Generic
for user-defined generic types
- Added support for parsing type aliases from RBI
- Added conversion from RBI to RBS type aliases
- Changed the RBS keyword warning to come from "RBS generation" rather than "Type generalization"
- Added many more of RBS' keywords which are detected and prefixed with an underscore to avoid syntax errors
- Added
Types::Type#describe
for simple text descriptions of types - Added
Types::Self
for RBI'sT.self_type
or RBS'self
- Fixed
RbiGenerator::Namespace#create_method
'sreturns:
kwarg only accepting String types - Fixed lack of spacing between argument lists and blocks in RBS
- Fixed RBS attributes not having comments
- Added RBS generation support! This includes:
- The new
RbsGenerator
class RbsObject
and a set of subclasses representing different RBS components
- The new
- Added the
Types
module, which is used to describe types agnostic of the underlying type system- Added
RbiGenerator::Namespace#generalize_from_rbi!
to convert RBI string types intoTypes
types - Specifying types as strings is still currently supported, but may be phased out in future, and should be avoided in new projects.
- Added
- Added conversion from RBI to RBS type trees
- Added a couple of classes to deduplicate functionality between type systems:
TypedObject
, whichRbiObject
andRbsObject
both inherit fromGenerator
, whichRbiGenerator
andRbsGenerator
both inherit from
- Added RBI type aliases
Parlour::RbiGenerator::Options
is nowParlour::Options
. An alias exists for now, butParlour::RbiGenerator::Options
is deprecated and could be removed in future versions.- Updated README and gem metadata to refer to Parlour as a type information generator, rather than just an RBI generator
- Fixed duplicate includes and extends.
- Fixed the block return type for
#resolve_conflicts
not being nilable.
- Parlour now defaults to loading the current project when running its command
line tool, allowing it to be used as a "
sig
extractor" when run without plugins! Breaking if you invoke Parlour from its command line tool - to revert to the old behaviour of having nothing loaded into the root namespace initially, addparser: false
to your.parlour
file. - Generating constants in an eigenclass context (
class << self
) is now supported.
T::Struct
classes can now be generated and parsed.T::Enum
classes can now be parsed.- Constants are now parsed.
TypeParser
now detects and parses methods which do not have asig
. Potentially breaking if there is a strict set of methods you are expecting Parlour to detect.
- "Specialized" classes, such as enums and now structs, have had many erroneous conflicts with standard classes or namespaces fixed.
- Attributes writers and methods with the same name no longer conflict incorrectly.
- Files can now be excluded from the
TypeLoader
.
- A block argument in the definition but not in the signature no longer causes
an error in the
TypeParser
. - Sorting of namespace children is now a stable sort.
- Type parameters are now parsed by the
TypeParser
.
- Parlour can now load types back out of RBI files or Ruby source files by
parsing them, using the
TypeLoader
module. - The
sort_namespaces
option has been added toRbiGenerator
to alphabetically sort all namespace children. - Added
DetachedRbiGenerator
, which can be used to create instances ofRbiObject
which are not bound to a particular set of options. This is used internally forTypeLoader
. - Parlour will now create a polyfill for
then
onKernel
. - Added
NodePath#sibling
.
- Version restrictions on rainbow and commander have been slightly relaxed.
- The version of sorbet-runtime is now restricted to
>= 0.5
after previously being unrestricted. - Instances of
Namespace
can now be merged with instances ofClassNamespace
orMethodNamespace
. - A method and a namespace can now have the same name without causing a merge conflict.
- Parameter names are no longer nilable. Potentially breaking if you were doing something cursed with Parameter names.
T::Enum
classes have been implemented, and can be generated using#create_enum_class
.- Methods and namespaces can now be made final using the
final:
keyword argument. - Type aliases can be created on namespaces using
#create_type_alias
. - The
.parlour
file can now have globs inrelative_requires
to load many files matching a pattern at once.
- Commander is now a gemspec dependency.
- Running with the PARLOUR_DEBUG environment variable set will now print debug output to the console during conflict resolution.
- Performance is now much faster when the conflict resolver needs to resolve a conflict between many identical objects.
- Methods can now have type parameters specified.
- Breaking change: The
implementation
qualifier is no longer genereated. Following Sorbet mergingimplementation
andoverride
into justoverride
, theMethod#implementation
andMethod#override
flags will now both generate theoverride
qualifier. - The Parlour codebase now uses
override
for both abstract implementation and superclass overriding to conform to this change.
- The strictness level can now be specified when generating an RBI, using an
optional positional argument to
RBIGenerator#generate
. The default strictness isstrong
. - Plugins can specify a strictness level they would prefer by setting
Plugin#strictness
for themselves. If multiple plugins set conflicting strictnesses, the least strict will be used. - Attributes can now specified as class attributes by setting
Attribute#class_attribute
totrue
. This will wrap them in aclass << self
block.
- The
sorbet
directory is no longer included in the built gem. - Generated files now end with a new line (
\n
).
- An instance method and a class method with the same name are no longer considered conflicting.
- The signature for the constructor of
Attribute
previously typed the optional initializer block as taking aMethod
. This has been corrected to taking anAttribute
.
- Various areas of the codebase have been made compatible with older Ruby versions.
- Breaking change: the
name:
keyword argument is now positional instead. Instead ofcreate_method(name: 'A', returns: 'String')
, usecreate_method('A', returns: 'String')
. - Altered some syntax to improve compatibility with previous Ruby versions. (Full compatibility is still WIP.)
- Fixed some Sorbet type signatures.
- Fixed an RSpec warning.
- Added the
Namespace#create_includes
andNamespace#create_extends
methods to add multipleinclude
andextend
calls at once.
- Signatures for some methods using keyword parameters have been altered such
that those keywords are required. Previously, these parameters defaulted to
nil
, and the Sorbet runtime would fail an assertion if they weren't present.
- Fixed some incorrect documentation for the
Namespace
methodspath
andcreate_constant
. - Fixed a Sorbet signature for
Method#describe
which was causing an exception.
- Added the
Namespace#path
method for plugins to use.
- Added the
create_arbitrary
method for inserting arbitrary code into the generated RBI file. This is intended for using constructs which Parlour does not yet support.
- Breaking change:
add_constant
,add_include
andadd_extend
have been replaced withcreate_constant
,create_include
andcreate_extend
.
- Breaking change: The Parlour CLI tool no longer takes command-line arguments, and instead uses a
.parlour
configuration file. See the README! - RBIs now begin with
# typed: strong
. - Plugins now define a stub constructor to avoid an exception if they don't define one.
- Multi-line parameter lists no longer have a trailing comma.
- Breaking change: all
Namespace#create_
methods, and theParameter
constructor, now take entirely keyword arguments. For example,create_method('A', [], 'String')
is now written ascreate_method(name: 'A', returns: 'String')
.
- Fixed a bug which occasionally caused includes and extends to generate incorrectly.
- Added the
add_comment_to_next_child
method to namespaces.
- Add support for plugins using the
parlour
command-line tool. - Comments can now be added using
add_comment
. - Attribute readers, writers and accessors can now be created, using the
create_attr_...
methods. - All objects are now YARD documented.
- The
RbiObject
, which is core to Parlour's internals, is now an abstract class rather than an interface. ConflictResolver
now recurses to child namespaces.create_method
now takes an initializer block like othercreate_
methods.
- Initial release!
(0.1.0 was a blank gem.)