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

stdlib/resolv: Resolv::DNS::Resource::Generic.create returns a class #1655

Merged
merged 2 commits into from
Nov 30, 2023

Conversation

hanazuki
Copy link
Contributor

Resolv::DNS::Resource::Generic.create is not a data constructor but defines a new subclass of Resolv::DNS::Resource::Generic and returns it.

% irb -rresolv
irb(main):001> rrtype = Resolv::DNS::Resource::Generic.create(65280, Resolv::DNS::Resource::IN::ClassValue)
=> Resolv::DNS::Resource::Generic::Type65280_Class1
irb(main):002> rrtype.class
=> Class
irb(main):003> rrtype.superclass
=> Resolv::DNS::Resource::Generic

The result type is some subclass of Generic, but, IIUC, RBS currently has no way to express the upper bound for a Class (ref. #1542).

`Resolv::DNS::Resource::Generic.create` is not a data constructor but
defines a new subclass of `Resolv::DNS::Resource::Generic` and returns
it.

```
% irb -rresolv
irb(main):001> rrtype = Resolv::DNS::Resource::Generic.create(65280, Resolv::DNS::Resource::IN::ClassValue)
=> Resolv::DNS::Resource::Generic::Type65280_Class1
irb(main):002> rrtype.class
=> Class
irb(main):003> rrtype.superclass
=> Resolv::DNS::Resource::Generic
```
Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@soutaro soutaro added this to the RBS 3.4 milestone Nov 30, 2023
@soutaro soutaro added this pull request to the merge queue Nov 30, 2023
Merged via the queue into ruby:master with commit 98f2ed1 Nov 30, 2023
24 checks passed
soutaro added a commit that referenced this pull request Dec 20, 2023
…neric-create"

This reverts commit 98f2ed1, reversing
changes made to 27c536c.
@soutaro soutaro added the Released PRs already included in the released version label Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Released PRs already included in the released version
Development

Successfully merging this pull request may close these issues.

2 participants