ruby / rbs

Type Signature for Ruby
Other
1.96k stars 215 forks source link

RBS support for delegate #836

Open mullermp opened 2 years ago

mullermp commented 2 years ago

Hey. We use SimpleDelegator but I can't reference it in any of my RBS files. Would this be feasible to add?

pocke commented 2 years ago

Thanks for reporting the issue.

Currently, RBS has no support for delegate library.

I have a plan to support delegate by RBS with two steps.

First, add the type definitions of delegate to ruby/rbs repository. By this change, SimpleDelegator class's RBS will be available. Then type checking will be green on class MyDelegator < SimpleDelegator definition.

Second, provide the delegated methods' RBSs. For example, an object created by SimpleDelegator.new([]) should have the same methods as Array, but it doesn't even if we apply the first step. I guess we need an RBS generator but I haven't thought about it deeply yet.

hsbt commented 2 years ago

@pocke Thanks for explanation.

mullermp commented 2 years ago

Thanks both for responding. Should this issue be left open until implemented, or moved to ruby/rbs repo?

pocke commented 2 years ago

I've transferred this issue to ruby/rbs repo :rocket:

mullermp commented 2 years ago

This might be related https://github.com/ruby/rbs/pull/765