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 dispatch
3+# to the parent's method body for both parent and child instances.
4+
5+class A
6+ def x
7+ "from-x"
8+ end
9+end
10+
11+class B < A
12+end
13+
14+def call_x(e)
15+ e.x
16+end
17+
18+puts call_x(A.new)
19+puts call_x(B.new)