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

Added WithEnum#but and with_range #1649

Merged
merged 1 commit into from Nov 27, 2023

Conversation

sampersand
Copy link
Contributor

@sampersand sampersand commented Nov 26, 2023

This adds the WithEnum#but and WithAliases#with_range functions, and has a small bugfix with WithEnum#and.

  • The WithEnum#but is for omitting things from with_untyped, such as
class MatchDataInstanceTest < Test::Unit::TestCase
  def test_eq(method: :==)
    # ...
    with_untyped.but MatchData do |untyped|
      assert_send_type  '(untyped) -> false',
                        INSTANCE, method, untyped
    end
  end
end

That way we won't accidentally get test failures if we update what with_untyped yields in the future.

  • with_range is me finally adding support for testing the range[T] type alias.

@sampersand sampersand marked this pull request as ready for review November 26, 2023 21:30
@sampersand sampersand force-pushed the swesterman/23-11-26/update-withenum branch from c9c1173 to 1913965 Compare November 26, 2023 21:43
@sampersand sampersand mentioned this pull request Nov 26, 2023
return WithEnum.new to_enum(__method__, *args) unless block_given?

each do |arg|
yield arg unless cases.any? { _1 === arg }
Copy link
Member

Choose a reason for hiding this comment

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

Wow! we can use numbered parameter now!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah! :-)

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 27, 2023
@soutaro soutaro added this pull request to the merge queue Nov 27, 2023
Merged via the queue into ruby:master with commit a15863f Nov 27, 2023
24 checks passed
soutaro added a commit that referenced this pull request Dec 20, 2023
…update-withenum"

This reverts commit a15863f, reversing
changes made to 77328dd.
@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.

None yet

2 participants