Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit dec595a2 authored by Ary Borenszweig's avatar Ary Borenszweig
Browse files

Fixed serious dispatch bug when invoking a top level method inside a class type or hierarchy type

parent 5371113d
Branches
Tags
No related merge requests found
......@@ -349,4 +349,47 @@ describe "Code gen: def" do
f.object_id
").to_i.should eq(0)
end
it "codegens dispatch without obj, bug 1" do
run("
def coco(x : Int32)
2
end
def coco(x)
3
end
class Foo
def foo
coco(1 || nil)
end
end
Foo.new.foo
").to_i.should eq(2)
end
it "codegens dispatch without obj, bug 1" do
run("
def coco(x : Int32)
2
end
def coco(x)
3
end
class Foo
def foo
coco(1 || nil)
end
end
class Bar < Foo
end
(Foo.new || Bar.new).foo
").to_i.should eq(2)
end
end
......@@ -1777,6 +1777,10 @@ module Crystal
end
end
def match_type_id(type, restriction : Program, type_id)
llvm_true
end
def match_type_id(type, restriction, type_id)
case type
when UnionType, HierarchyType, HierarchyMetaclassType
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment