Handle alt on a _|_ - typed value

Return the result of the discriminant from trans_alt,
rather than nil, in the _|_ case. This was breaking the
enclosed test case (alt-bot-2) when optimization was disabled.

Closes #769
This commit is contained in:
Tim Chevalier 2011-08-04 16:07:26 -07:00
parent 5f03ca48d8
commit e0985c1060
2 changed files with 4 additions and 1 deletions

View File

@ -433,7 +433,7 @@ fn trans_alt(cx: &@block_ctxt, expr: &@ast::expr, arms: &ast::arm[],
ret rslt(cx, cx.build.Unreachable());
}
else {
ret rslt(cx, C_nil());
ret er;
}
}

View File

@ -0,0 +1,3 @@
// n.b. This was only ever failing with optimization disabled.
fn a() -> int { alt ret 1 { 2 { 3 } } }
fn main() { a(); }