-
Notifications
You must be signed in to change notification settings - Fork 199
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
Cannot specify type variables for instance
#1521
Comments
I know there are some cases that requires that kind of types, but we don't have a plan to support it at least for now. A class inheriting from a generic class may be non-generic, and what can we do for class Generic[T]
def foo: () -> instance[Array[T]]
end
class NonGeneric < Generic[String]
end
# Even worse if it inherited by another generic class.
class AnotherGeneric[T] < NonGeneric
end |
How about letting class methods pick up generics? |
Would this rather be a Steep job? Unless the RBS gem itself also involved… |
Generics in RBS currently is for instance types. I think no other programming language allows this. Do you know any example? |
The type you want would be this?
Steep allows explicit type application, and it will help:
|
Almost. The strength of
Good to know more 👍. Steep really lacks detailed and locatable docs for Ruby annotations, both in-line and |
Even Steep is aware of this limitation:
https://github.com/soutaro/steep/blob/v1.5.3/lib/steep/subtyping/check.rb#L307
Proposal:
instance[E]
?The problem might be significant for
class
as well:https://github.com/soutaro/steep/blob/v1.5.3/lib/steep/subtyping/check.rb#L322
The text was updated successfully, but these errors were encountered: