Skip to content

Update Range#step to accept Numerics and int - #1709

Merged
soutaro merged 1 commit into
ruby:masterfrom
sampersand:swesterman/24-01-04/update-Range#step
Jan 5, 2024
Merged

soutaro merged 1 commit into
ruby:masterfrom
sampersand:swesterman/24-01-04/update-Range#step

Conversation

@sampersand

@sampersand sampersand commented Jan 5, 2024 •

Copy link
Copy Markdown
Contributor

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

@soutaro soutaro left a comment

Copy link
Copy Markdown
Member

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
@soutaro

soutaro commented Jan 5, 2024 •

Copy link
Copy Markdown
Member

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
Copy Markdown
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

soutaro commented Jan 5, 2024

Copy link
Copy Markdown
Member

@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants