Shopify / tapioca

The swiss army knife of RBI generation
MIT License
746 stars 128 forks source link

Invalid RBI for Prism? #1862

Closed andyw8 closed 7 months ago

andyw8 commented 7 months ago

I haven't yet determined if this is an issue in Prism or Tapioca:

When generating the RBI for the latest Prism (v0.25.0), it fails with:

  RBIs exported by `prism` contain errors and can't be used:
Cause: duplicated argument name. (/Users/andyw8/.gem/ruby/3.3.0/gems/prism-0.25.0/rbi/prism.rbi:50:58)

The RBI entry contains the offset argument twice:

  sig { params(source: String, filepath: T.nilable(String), line: T.nilable(Integer), offset: T.nilable(Integer), encoding: T.nilable(Encoding), frozen_string_literal: T.nilable(T::Boolean), verbose: T.nilable(T::Boolean), scopes: T.nilable(T::Array[T::Array[Symbol]])).returns(T::Boolean) }
  def self.parse_failure?(source, offset: nil, line: nil, offset: nil, encoding: nil, frozen_string_literal: nil, verbose: nil, scopes: nil); end

but it's not duplicated in https://github.com/ruby/prism/blob/5146cc2c12e2a273d7672ba7d8711c637babade0/rbi/prism.rbi#L49-L50

andyw8 commented 7 months ago

I tried again and didn't encounter this, so I'll close for now.

andyw8 commented 7 months ago

Ok I can reproduce on https://github.com/Shopify/ruby-lsp/pull/1913 with bundle exec tapioca gem prism

@kddnewton were there are changes around RBI generation that might relate to this?

kddnewton commented 7 months ago

I don't think so, I think this is a hand-written file. Can you open a PR?

Morriar commented 7 months ago

I think I already fixed it in https://github.com/ruby/prism/pull/2685.