I've tried out running sorbet on our code base.
I've run into the following problem stemming from Twitter CLDR.
sorbet/rbi/hidden-definitions/hidden.rbi:175756: Method TwitterCldr::Segmentation::StateMachine.instance redefined without matching argument count. Expected: 0, got: 2 https://srb.help/4010
175756 | def self.instance(boundary_type, locale); end
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sorbet/rbi/hidden-definitions/hidden.rbi:175730: Previous definition
175730 | include ::Singleton
^^^^^^^^^^^^^^^^^^^
Same error for TwitterCldr::Segmentation::StateMachine.instance, TwitterCldr::Segmentation::Suppressions.instance, TwitterCldr::Shared::DayPeriods.instance and TwitterCldr::Timezones::Timezone.instance. This search will also bring up the relevant files: https://github.com/twitter/twitter-cldr-rb/search?q=instance+singleton
I guess one solution could be to rename the instance method, so it doesn't collide with instance method defined via Singleton module:
def locale_instance(locale)
instance_cache[locale] ||= new(locale)
end
Another solution would be to not use the Singleton module, but that's likely more work.
If you'd accept a PR I can try to make a change where instance is renamed to locale_instance (or maybe cached_instance).
I've tried out running sorbet on our code base.
I've run into the following problem stemming from Twitter CLDR.
Same error for
TwitterCldr::Segmentation::StateMachine.instance,TwitterCldr::Segmentation::Suppressions.instance,TwitterCldr::Shared::DayPeriods.instanceandTwitterCldr::Timezones::Timezone.instance. This search will also bring up the relevant files: https://github.com/twitter/twitter-cldr-rb/search?q=instance+singletonI guess one solution could be to rename the instance method, so it doesn't collide with
instancemethod defined viaSingletonmodule:Another solution would be to not use the
Singletonmodule, but that's likely more work.If you'd accept a PR I can try to make a change where
instanceis renamed tolocale_instance(or maybecached_instance).