From 8f9b393b4d204b621c69c4215e9920f1d774ccc8 Mon Sep 17 00:00:00 2001 From: SamW Date: Sun, 23 Nov 2025 16:34:53 -0800 Subject: [PATCH] [Enumerable] Update include? to accept untyped --- core/enumerable.rbs | 4 ++-- test/stdlib/Enumerable_test.rb | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/core/enumerable.rbs b/core/enumerable.rbs index aab7bcf72..4e4067667 100644 --- a/core/enumerable.rbs +++ b/core/enumerable.rbs @@ -725,7 +725,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # {foo: 0, bar: 1, baz: 2}.include?('foo') # => false # {foo: 0, bar: 1, baz: 2}.include?(0) # => false # - def include?: (Elem arg0) -> bool + def include?: (untyped object) -> bool # # Returns the result of applying a reducer to an initial value and the first diff --git a/test/stdlib/Enumerable_test.rb b/test/stdlib/Enumerable_test.rb index 7c36fff90..6b41c4d1c 100644 --- a/test/stdlib/Enumerable_test.rb +++ b/test/stdlib/Enumerable_test.rb @@ -265,4 +265,15 @@ def test_one_p assert_send_type '(Class) -> bool', TestEnumerable.new, :one?, String assert_send_type '() { (String) -> bool } -> bool', TestEnumerable.new, :one? do |x| x == '0' end end + + def test_include?(method: :include?) + with_untyped.and '1' do |element| + assert_send_type '(untyped) -> bool', + TestEnumerable.new, method, element + end + end + + def test_member? + test_include?(method: :member?) + end end