Commit b8366087
b836608745b3Merged
Dmitry Bochkarev <[email protected]> · 6 months ago · 2 files · +2 added
Description
test: inherited method dispatch via poly recv
Details
- Commit
- b836608745b3
- Parent
- 93764f211cfa
test/poly_dispatch_inherited_method.rbaddedView file
1+
# Parent defines a method, child inherits it.2+
# Calling the method via a poly-typed parameter must dispatch3+
# to the parent's method body for both parent and child instances.4+
5+
class A6+
def x7+
"from-x"8+
end9+
end10+
11+
class B < A12+
end13+
14+
def call_x(e)15+
e.x16+
end17+
18+
puts call_x(A.new)19+
puts call_x(B.new)test/poly_dispatch_inherited_method.rb.expectedaddedView file
Loading diff…