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

Update Range#step to accept Numerics and int #1709

Merged

Conversation

sampersand
Copy link
Contributor

@sampersand sampersand commented Jan 5, 2024

Updated per a request. No tests added because Range_test.rbs is still on the old version and I didn't want to overhaul it for this pr

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 enabled auto-merge January 5, 2024 03:22
@soutaro soutaro added this to the RBS 3.5 milestone Jan 5, 2024
@soutaro soutaro added this pull request to the merge queue Jan 5, 2024
Merged via the queue into ruby:master with commit 298589f Jan 5, 2024
23 checks passed
@soutaro
Copy link
Member

soutaro commented Jan 5, 2024

I found the Range#step without block returns an Enumerator[Elem, Enumerator[Elem, Enumerator[Elem, ...]]], not Enumerator[Enum, self]. Merged this PR because the infinite type cannot be written in RBS... (Enumerator[Elem, untyped] may be better, but not sure if it makes more sense...)

Adding a new syntax something like Enumerator[Enum, T] as T would help giving precise type to this, but...

@ParadoxV5
Copy link
Contributor

Merged this PR because the infinite type cannot be written in RBS... (Enumerator[Elem, untyped] may be better, but not sure if it makes more sense...)

Adding a new syntax something like Enumerator[Enum, T] as T would help giving precise type to this, but...

@soutaro Type aliases can be recursive.

@sampersand already added a bunch of interfaces to describe the CRuby implementation details, another one-time-use type alias wouldn’t hurt…

@soutaro
Copy link
Member

soutaro commented Jan 5, 2024

@ParadoxV5 Yeah! True. We can define it by adding a helper recursive type alias!

type recursive_enum[T] = Enumerator[T, recursive_enum[T]]

@soutaro soutaro added the Released PRs already included in the released version label Jun 6, 2024
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.

3 participants