Skip to content

Commit 59b600b

Browse files
author
Ary Borenszweig
committedNov 12, 2016
Fixed #3529: Stored value type does not match pointer operand type
1 parent 2ce8c24 commit 59b600b

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed
 

Diff for: ‎spec/compiler/codegen/def_spec.cr

+18
Original file line numberDiff line numberDiff line change
@@ -530,4 +530,22 @@ describe "Code gen: def" do
530530
fn(n)
531531
)).to_i.should eq(10)
532532
end
533+
534+
it "uses dispatch call type for phi (#3529)" do
535+
codegen(%(
536+
def foo(x : Int32)
537+
yield
538+
1.0
539+
end
540+
541+
def foo(x : Int64)
542+
yield
543+
1.0
544+
end
545+
546+
foo(1 || 1_i64) do
547+
break
548+
end
549+
), inject_primitives: false)
550+
end
533551
end

Diff for: ‎src/compiler/crystal/codegen/call.cr

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ class Crystal::CodeGenVisitor
367367
end
368368
accept call
369369

370-
phi.add @last, a_def.type
370+
phi.add @last, call.type
371371
position_at_end next_def_label
372372
end
373373
unreachable

0 commit comments

Comments
 (0)
Please sign in to comment.