yob / pdf-reader

The PDF::Reader library implements a PDF parser conforming as much as possible to the PDF specification from Adobe.
MIT License
1.82k stars 271 forks source link

IRB incompatible with latest Sorbet + Tapioca #511

Closed iMacTia closed 1 year ago

iMacTia commented 1 year ago

We just updated sorbet and tapioca to the latest versions (0.11.5 respectively), and regenerated all gems RBIs. For some reason, signatures bundled with this gem were previously ignored, but they're not anymore (which is great!). However, there seems to be a small issue:

$ bundle exec srb tc
sorbet/rbi/gems/pdf-reader@2.11.0.rbi:2216: Unable to resolve constant `EventPoint` https://srb.help/5002
    2216 |    sig { params(sweep_line_status: T::Array[PDF::Reader::TextRun], event_point: EventPoint).returns(T::Boolean) }
                                                                                           ^^^^^^^^^^
  Did you mean `PDF::Reader::EventPoint`? Use `-a` to autocorrect
    sorbet/rbi/gems/pdf-reader@2.11.0.rbi:2216: Replace with `PDF::Reader::EventPoint`
    2216 |    sig { params(sweep_line_status: T::Array[PDF::Reader::TextRun], event_point: EventPoint).returns(T::Boolean) }
                                                                                           ^^^^^^^^^^
    sorbet/rbi/gems/pdf-reader@2.11.0.rbi:785: `PDF::Reader::EventPoint` defined here
     785 |class PDF::Reader::EventPoint
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Errors: 1

I checked the code, and the error seems to be originating from here.

My guess is that this is due to the EventPoint class being defined later in the file, but I'm surprised this hasn't caused any issue before.

iMacTia commented 1 year ago

I went ahead and tested this on a fork, it works properly after the fix 🎉 So I've opened a PR to fix this upstream, see #512