Forum | Documentation | Website | Blog

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

Fixed: union type was incorrectly calculated

parent e79483d2
No related merge requests found
...@@ -101,4 +101,13 @@ describe "Code gen: tuple" do ...@@ -101,4 +101,13 @@ describe "Code gen: tuple" do
p.value[0] + p.value[1] p.value[0] + p.value[1]
").to_i.should eq(3) ").to_i.should eq(3)
end end
it "codegens tuple union (bug because union size was computed incorrectly)" do
run(%(
require "prelude"
x = 1 == 1 ? {1, 1, 1} : {1}
i = 2
x[i]
)).to_i.should eq(1)
end
end end
...@@ -124,10 +124,11 @@ module Crystal ...@@ -124,10 +124,11 @@ module Crystal
end end
ifdef x86_64 ifdef x86_64
max_size /= 8 max_size /= 8.0
else else
max_size /= 4 max_size /= 4.0
end end
max_size = max_size.ceil
max_size = 1 if max_size == 0 max_size = 1 if max_size == 0
......
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