Skip to content

Update Integer, phase 2#3001

Open
sampersand wants to merge 10 commits into
ruby:masterfrom
sampersand:swesterman/2026-06-16/update-integer-round-2
Open

Update Integer, phase 2#3001
sampersand wants to merge 10 commits into
ruby:masterfrom
sampersand:swesterman/2026-06-16/update-integer-round-2

Conversation

@sampersand

@sampersand sampersand commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This is the second phase for updating Integer (phase one is #2995).

Here, we finish off the rest of the methods, including the ones which required coerce. The _Coerce interface (which is on Numeric) actually slots quite nicely:

class Numeric
  interface _Coerce[O, Other, Self]
    def coerce: (O other) -> [Other, Self]
  end
end

class Integer < Numeric
  def +: (Integer other) -> Integer
       | [S, R] (Numeric::_Coerce[self, RBS::Ops::_Add[S, R], S] other) -> R
end

We don't even need separate cases for other numerics, as coerce works!

@sampersand sampersand changed the title swesterman/2026 06 16/update integer round 2 Update Integer, phase 2 Jun 16, 2026
@sampersand sampersand force-pushed the swesterman/2026-06-16/update-integer-round-2 branch from 87679dc to 47dcb0b Compare June 16, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant