rbs icon indicating copy to clipboard operation
rbs copied to clipboard

RBS support for delegate

Open mullermp opened this issue 3 years ago • 5 comments

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

mullermp avatar Dec 01 '21 00:12 mullermp

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.

pocke avatar Dec 01 '21 05:12 pocke

@pocke Thanks for explanation.

hsbt avatar Dec 01 '21 06:12 hsbt

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

mullermp avatar Dec 01 '21 17:12 mullermp

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

pocke avatar Dec 02 '21 04:12 pocke

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

mullermp avatar Dec 02 '21 19:12 mullermp