All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog.
- Fixed a possible hang when getting a file list from Sorbet during type loading. (Thanks @apiology and @ojgarcia)
- Replaced YARD
@abstractdirectives, as they now conflict with Sorbet'sabstract!directives when using Tapioca
- Constants can now be generated or parsed with heredoc strings. (Thanks @apiology)
T.proctypes with no parameters are now emitted correctly. Previously, they emitted an invalid call toparams()- now they emit no usage ofparams. (Thanks @apiology)
- Updated Commander dependency to 5.0, to remove
abbrevdeprecation warning. As a result, the minimum supported Ruby version is now 3.0.
- Parsed method definitions can now have a modifier before the
defkeyword.
- Use
File#exist?instead ofFile#exists?in CLI, fixing an exception on Ruby 3.2.0. - Resolved incorrect code generation for
T::Enums with only one variant.
- The parser now loads untyped methods named
initializeas returningvoid, rather thanuntyped. Potentially breaking if you are relying on this behaviour, though Sorbet now considers this an error.
#describenow uses a new, clearer format.- Added
#describe_tree, which produces#describeoutput for a node and all of its children. - Added
#findand#find_allfor retrieving a node's children based on criteria.
- Parlour now uses the new block-based
type_membersyntax 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.
#inspectand#to_snow 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#pathwill now work much more reliably for classes and modules which replace methods fromModuleandClass, such as#name.
- Added RBS generation support! This includes:
- The new
RbsGeneratorclass RbsObjectand 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
Typesmodule, which is used to describe types agnostic of the underlying type system- Added
RbiGenerator::Namespace#generalize_from_rbi!to convert RBI string types intoTypestypes - 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, whichRbiObjectandRbsObjectboth inherit fromGenerator, whichRbiGeneratorandRbsGeneratorboth inherit from
- Added RBI type aliases
- Added
sealed!for RBI namespaces - Added
abstract!for RBI modules
Parlour::RbiGenerator::Optionsis nowParlour::Options. An alias exists for now, butParlour::RbiGenerator::Optionsis 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::Genericfor 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#describefor simple text descriptions of types - Added
Types::Selffor RBI'sT.self_typeor 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
RbsGeneratorclass RbsObjectand a set of subclasses representing different RBS components
- The new
- Added the
Typesmodule, which is used to describe types agnostic of the underlying type system- Added
RbiGenerator::Namespace#generalize_from_rbi!to convert RBI string types intoTypestypes - 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, whichRbiObjectandRbsObjectboth inherit fromGenerator, whichRbiGeneratorandRbsGeneratorboth inherit from
- Added RBI type aliases
Parlour::RbiGenerator::Optionsis nowParlour::Options. An alias exists for now, butParlour::RbiGenerator::Optionsis 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_conflictsnot being nilable.
- Parlour now defaults to loading the current project when running its command
line tool, allowing it to be used as a "
sigextractor" 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: falseto your.parlourfile. - Generating constants in an eigenclass context (
class << self) is now supported.
T::Structclasses can now be generated and parsed.T::Enumclasses can now be parsed.- Constants are now parsed.
TypeParsernow 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
TypeLoadermodule. - The
sort_namespacesoption has been added toRbiGeneratorto alphabetically sort all namespace children. - Added
DetachedRbiGenerator, which can be used to create instances ofRbiObjectwhich are not bound to a particular set of options. This is used internally forTypeLoader. - Parlour will now create a polyfill for
thenonKernel. - Added
NodePath#sibling.
- Version restrictions on rainbow and commander have been slightly relaxed.
- The version of sorbet-runtime is now restricted to
>= 0.5after previously being unrestricted. - Instances of
Namespacecan now be merged with instances ofClassNamespaceorMethodNamespace. - 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::Enumclasses 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
.parlourfile can now have globs inrelative_requiresto 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
implementationqualifier is no longer genereated. Following Sorbet mergingimplementationandoverrideinto justoverride, theMethod#implementationandMethod#overrideflags will now both generate theoverridequalifier. - The Parlour codebase now uses
overridefor 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#strictnessfor themselves. If multiple plugins set conflicting strictnesses, the least strict will be used. - Attributes can now specified as class attributes by setting
Attribute#class_attributetotrue. This will wrap them in aclass << selfblock.
- The
sorbetdirectory 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
Attributepreviously 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_includesandNamespace#create_extendsmethods to add multipleincludeandextendcalls 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
Namespacemethodspathandcreate_constant. - Fixed a Sorbet signature for
Method#describewhich was causing an exception.
- Added the
Namespace#pathmethod for plugins to use.
- Added the
create_arbitrarymethod 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_includeandadd_extendhave been replaced withcreate_constant,create_includeandcreate_extend.
- Breaking change: The Parlour CLI tool no longer takes command-line arguments, and instead uses a
.parlourconfiguration 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 theParameterconstructor, 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_childmethod to namespaces.
- Add support for plugins using the
parlourcommand-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. ConflictResolvernow recurses to child namespaces.create_methodnow takes an initializer block like othercreate_methods.
- Initial release!
(0.1.0 was a blank gem.)