Skip to content

Tapioca v0.18.0 generates invalid gem RBI for stripe gem #2589

@olivier-thatch

Description

@olivier-thatch

Hi all,

I'm upgrading our codebase from Sorbet 0.5 and Tapioca 0.17.9 to Sorbet 0.6 and Tapioca 0.19.0.

After force regenerating all gem RBIs, Sorbet reports 24418 (!) errors in sorbet/rbi/gems/stripe@19.0.0.rbi.

At a glance, it appears that the signatures for all write accessors throughout the stripe gem are invalid:

sorbet/rbi/gems/stripe@19.0.0.rbi:4316: Malformed sig. Type not specified for parameter value https://srb.help/5003
    4316 |  def expand=(value); end
                        ^^^^^
    sorbet/rbi/gems/stripe@19.0.0.rbi:4315: Add it to the signature's params here
    4315 |  sig { params(_expand: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) }

The stripe gem provides its own RBI signatures, and the signatures for write accessors use _name as the argument name, e.g.:

    sig { params(_expand: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) }
    def expand=(_expand); end

(from https://github.com/stripe/stripe-ruby/blob/v19.0.0/rbi/stripe/params/account_capability_list_params.rbi#L10-L11)

However, for some reason Tapioca forcefully replaces the argument name with value in the method definition, but not in the signature:

  # pkg:gem/stripe#lib/stripe/params/account_capability_list_params.rb:7
  sig { params(_expand: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) }
  def expand=(value); end

At first I thought this might be related to #2248, but this appears to be a different issue. AFAICT, this is caused by a behavior change in Tapioca v0.18.0. When I force-regenerate the RBI with Tapioca v0.17.9, everything's fine.

I can work around it by not regenerating the RBI for the stripe gem for the time being, but this only works until we need to upgrade the stripe gem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions