Skip to content

Commit ca70db7

Browse files
authored
Merge pull request #2878 from ruby/predicate-top
`top` for membership predicates of collection types
2 parents 02384db + c5eca60 commit ca70db7

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

core/array.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2215,7 +2215,7 @@ class Array[unchecked out Elem] < Object
22152215
#
22162216
# Related: see [Methods for Querying](rdoc-ref:Array@Methods+for+Querying).
22172217
#
2218-
def include?: (Elem object) -> bool
2218+
def include?: (top object) -> bool
22192219

22202220
# <!-- rdoc-file=array.c -->
22212221
# Returns the zero-based integer index of a specified element, or `nil`.

core/enumerable.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem]
816816
# {foo: 0, bar: 1, baz: 2}.include?('foo') # => false
817817
# {foo: 0, bar: 1, baz: 2}.include?(0) # => false
818818
#
819-
def include?: (Elem arg0) -> bool
819+
def include?: (top arg0) -> bool
820820

821821
# <!--
822822
# rdoc-file=enum.c
@@ -1663,7 +1663,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem]
16631663
# {foo: 0, bar: 1, baz: 2}.include?('foo') # => false
16641664
# {foo: 0, bar: 1, baz: 2}.include?(0) # => false
16651665
#
1666-
def member?: (Elem arg0) -> bool
1666+
def member?: (top arg0) -> bool
16671667

16681668
# <!-- rdoc-file=enum.c -->
16691669
# Returns the result of applying a reducer to an initial value and the first

core/hash.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ class Hash[unchecked out K, unchecked out V] < Object
12671267
#
12681268
# Related: [Methods for Querying](rdoc-ref:Hash@Methods+for+Querying).
12691269
#
1270-
def has_key?: (K arg0) -> bool
1270+
def has_key?: (_Key) -> bool
12711271

12721272
# <!--
12731273
# rdoc-file=hash.c
@@ -1277,7 +1277,7 @@ class Hash[unchecked out K, unchecked out V] < Object
12771277
#
12781278
# Related: [Methods for Querying](rdoc-ref:Hash@Methods+for+Querying).
12791279
#
1280-
def has_value?: (V arg0) -> bool
1280+
def has_value?: (top arg0) -> bool
12811281

12821282
# <!--
12831283
# rdoc-file=hash.c

core/set.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ class Set[unchecked out A]
356356
#
357357
# See also Enumerable#include?
358358
#
359-
def include?: (A) -> bool
359+
def include?: (Hash::_Key) -> bool
360360

361361
# <!-- rdoc-file=set.c -->
362362
# Returns true if the set contains the given object:

0 commit comments

Comments
 (0)