chanzuckerberg / sorbet-rails

A set of tools to make the Sorbet typechecker work with Ruby on Rails seamlessly.
MIT License
638 stars 84 forks source link

regression on update to sorbet 0.5.9892+ #503

Closed ashkulz closed 2 years ago

ashkulz commented 2 years ago

Describe the bug: Sorbet 0.5.9892 and above includes sorbet/sorbet#5639 which causes regressions due to the changed type_member syntax. As mentioned there, the new syntax is supported on 0.5.9889 and above.

Steps to reproduce: Run rails_rbi:models and see an error

 sorbet/rails-rbi/models/MODEL.rbi:779: The `type_member` syntax for bounds has changed to use a block instead of keyword args https://srb.help/4021
     779 |  Elem = type_member(fixed: Model)
                               ^^^^^^^^^^^^

Expected behavior: No errors.

Workaround

Till this is fixed, we're using the following sed script:

grep -rl 'type_member' sorbet/rails-rbi/models/* | xargs --no-run-if-empty -L1 sed -ri 's/type_member\((.+)\)/type_member {{\1}}/g'
eneagoe commented 2 years ago

Thanks for the workaround. For mac os x users, the syntax is:

grep -rl 'type_member' sorbet/rails-rbi/models/* | xargs -r -L1 sed -r -i '' -E 's/type_member\((.+)\)/type_member {{\1}}/g'