Skip to content

Commit

Permalink
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions spec/compiler/codegen/def_spec.cr
Original file line number Diff line number Diff line change
@@ -530,4 +530,22 @@ describe "Code gen: def" do
fn(n)
)).to_i.should eq(10)
end

it "uses dispatch call type for phi (#3529)" do
codegen(%(
def foo(x : Int32)
yield
1.0
end
def foo(x : Int64)
yield
1.0
end
foo(1 || 1_i64) do
break
end
), inject_primitives: false)
end
end
2 changes: 1 addition & 1 deletion src/compiler/crystal/codegen/call.cr
Original file line number Diff line number Diff line change
@@ -367,7 +367,7 @@ class Crystal::CodeGenVisitor
end
accept call

phi.add @last, a_def.type
phi.add @last, call.type
position_at_end next_def_label
end
unreachable

0 comments on commit 59b600b

Please sign in to comment.