tapioca icon indicating copy to clipboard operation
tapioca copied to clipboard

Allow ignoring gem constants

Open gmalette opened this issue 10 months ago • 2 comments

Motivation

In one of our repos we're loading the same gem foo both in a dependency (gem bar), and directly in the host project. This foo gem is then generated with tapioca both as part of sorbet/rbi/gem/[email protected] and [email protected].

The problem lies in that foo signatures that can't be loaded twice by Sorbet, such at type_member and alias.

I've been able to sidestep the problem so far by having typed_overrides -> "ignore" and manually creating annotations for the gem, but the list of constants required grows every day and this is untenable. What I really need is to be able to say "ignore foo as generated in bar". This is what this PR does.

I haven't exposed this to the config.yml file yet

Implementation

This PR is the most bare-bones it can be; I just want to have a starting point for the discussion.

Tests

Basic test to show what I expect it to do.

gmalette avatar Feb 12 '25 20:02 gmalette

This foo gem is then generated with tapioca both as part of sorbet/rbi/gem/[email protected] and [email protected].

I think we should fix this root problem, instead of adding ignores for namespaces.

If the attribution of methods/constants to gems is wrong, we should fix that.

I actually think #293 might already fix this problem.

paracycle avatar Feb 13 '25 15:02 paracycle

I'm not sure #293 would fix it because both sources define the methods, but I'll be honest I don't fully understand how tapioca works

I think we should fix this root problem, instead of adding ignores for namespaces.

Sure... but how?

gmalette avatar Feb 13 '25 16:02 gmalette