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

Suggested sig for method with generics does not redeclare type_parameters #7257

Open
jez opened this issue Aug 25, 2023 · 0 comments
Open

Suggested sig for method with generics does not redeclare type_parameters #7257

jez opened this issue Aug 25, 2023 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@jez
Copy link
Collaborator

jez commented Aug 25, 2023

Input

→ View on sorbet.run

# typed: true

class MyAbstractClass
  extend T::Sig, T::Helpers
  abstract!

  sig {abstract.type_parameters(:U).params(x: T.type_parameter(:U)).returns(T.type_parameter(:U))}
  def example(x); end
end

class MyClass < MyAbstractClass
end

Observed output

editor.rb:11: Missing definition for abstract method `MyAbstractClass#example` https://srb.help/5023
    11 |class MyClass < MyAbstractClass
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    editor.rb:8: example defined here
     8 |  def example(x); end
          ^^^^^^^^^^^^^^
  Autocorrect: Use -a to autocorrect
    editor.rb:12: Insert sig {override.params(x: T.type_parameter(:U)).returns(T.type_parameter(:U))}
      def example(x); end
    12 |end
        ^
Errors: 1

Expected behavior


@jez jez added bug Something isn't working good first issue Good for newcomers labels Aug 25, 2023
@jez jez added this to the Autocorrects milestone Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant