core: Array#include? and Enumerable#include? should take non-Elem types
For example, Array[Integer] can take other number types validly:
> [1, 2, 3].include? 2.0
=> true
> [1, 2, 3].include? Complex(2)
=> true
> [1, 2, 3].include? Rational(2)
=> true
refs: https://github.com/soutaro/steep/issues/1482
In reality, it seems that the == method is being used as an interface.
irb(main):005> TracePoint.new(:a_call) { |tp| p tp }.enable { [1, 2, 3].include? 2.0 }
#<TracePoint:b_call (irb):5>
#<TracePoint:c_call 'include?' (irb):5>
#<TracePoint:c_call '==' (irb):5>
#<TracePoint:c_call '==' (irb):5>
=> true
However, since == is a method of BasicObject, it applies to almost all objects.
Therefore, using untyped is fine.
I prefer keeping the strict method type, because finding a code passing an unexpected object to include? actually helps.
Can you share the code where you want this? @tk0miya
Ah, https://github.com/soutaro/steep/issues/1482...
%w,true,.include?(ENV['foo'])
Hmm...
No conclusion yet, though I'm not very positive about this change. Skipped in 3.9.