Open
Description
All of the following should print 1
, regardless of whether the receiver or the argument is virtual:
abstract class Node; end
class ArrayNode < Node; end
class StringNode < Node; end
module ArrayLikePredicate
def foo(x : ArrayNode)
1
end
end
module StringLikePredicate
def foo(x : StringNode)
2
end
end
abstract class Foo
def foo(x)
3
end
end
class Bar < Foo
include ArrayLikePredicate
include StringLikePredicate
end
Bar.new.foo(ArrayNode.new) # => 1
Bar.new.foo(ArrayNode.new.as(Node)) # => 1
Bar.new.as(Foo).foo(ArrayNode.new) # => 1
Bar.new.as(Foo).foo(ArrayNode.new.as(Node)) # => 3
This is not a regression as I could replicate the same on very old compilers like 1.0. It is affected by neither -Dpreview_overload_order
nor #11840, and the interpreter has the same issue.