Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T.proc.bind does not work with generic #1139

Open
hdoan741 opened this issue Jun 29, 2019 · 3 comments
Open

T.proc.bind does not work with generic #1139

hdoan741 opened this issue Jun 29, 2019 · 3 comments
Labels
enhancement New feature or surprising current feature hard Daunting task, even for Sorbet team members

Comments

@hdoan741
Copy link
Contributor

Input

→ View on sorbet.run

Observed output

editor.rb:8: Malformed bind: Can only bind to simple class names https://srb.help/5003
     8 |  sig { params(block: T.proc.bind(Elem).void).void }
                              ^^^^^^^^^^^^^^^^^

Expected behavior

It should be possible to bind the proc to generic class.


@hdoan741 hdoan741 added enhancement New feature or surprising current feature unconfirmed This issue has not yet been confirmed by the Sorbet team labels Jun 29, 2019
@hdoan741
Copy link
Contributor Author

@elliottt @alexevanczuk

@jez jez added hard Daunting task, even for Sorbet team members and removed unconfirmed This issue has not yet been confirmed by the Sorbet team labels Aug 23, 2019
@jacobobq
Copy link
Contributor

jacobobq commented Jul 6, 2023

Support for this would be extremely useful to allow typing of things like RSpec describe and described_class in this fashion:

    sig do
      type_parameters(:DescribedClass)
        .params(
          described_class: T::Class[T.type_parameter(:DescribedClass)],
          args: T.untyped,
          example_group_block:
            T.proc.bind(DescribedClassContext[T.type_parameter(:DescribedClass)]).void
        )
        .void
    end
    def describe(described_class, *args, &example_group_block)
    end

@marknuzz
Copy link

Would love to see this as well. It would help a lot with prototyping ActiveAdmin resources or things of that nature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or surprising current feature hard Daunting task, even for Sorbet team members
Projects
None yet
Development

No branches or pull requests

4 participants