Shopify / rubocop-sorbet

A collection of RuboCop rules for Sorbet
MIT License
182 stars 27 forks source link

Forbid defining implicit conversion methods (to_ary, to_hash, to_int, to_str) #163

Closed dduugg closed 1 year ago

dduugg commented 1 year ago

Ruby supports a few methods that allow implicit type conversions.

Since Sorbet is a nominal (not structural) type system, implicit conversion is currently unsupported.

I would like to write a cop that adds violations when implicit conversion methods are defined. Would the maintainers be amenable to this?

Morriar commented 1 year ago

Yeah it seems like a good idea to have such a cop 👍

Depending on the amount of violations it creates, we may not enable it by default though.