Commit ea805982
ea80598202f6Merged
Dmitry Bochkarev <[email protected]> · 6 months ago · 2 files · +2 added
Description
test: multi-level inherited dispatch via poly recv
Details
- Commit
- ea80598202f6
- Parent
- 627925a9a309
test/poly_dispatch_multilevel_inheritance.rbaddedView file
1+
# Three-level inheritance (Base -> Child -> GrandChild) plus a2+
# Sibling. All inherit #greet from Base without overriding it.3+
# Calling via a poly-typed parameter must dispatch correctly for4+
# every level in the chain.5+
6+
class Base7+
def greet8+
"hello"9+
end10+
end11+
12+
class Child < Base13+
end14+
15+
class GrandChild < Child16+
end17+
18+
class Sibling < Base19+
end20+
21+
def call_greet(e)22+
e.greet23+
end24+
25+
puts call_greet(Base.new)26+
puts call_greet(Child.new)27+
puts call_greet(GrandChild.new)28+
puts call_greet(Sibling.new)test/poly_dispatch_multilevel_inheritance.rb.expectedaddedView file
Loading diff…