Handle log expressions with a _|_-typed level

If we have log(foo, quux) where foo:_|_, just translate foo and
ignore the rest of the expression.

Closes #1459
This commit is contained in:
Tim Chevalier 2012-01-19 14:28:58 -08:00
parent 840a057556
commit 94d2063577
2 changed files with 10 additions and 0 deletions

View File

@ -3700,7 +3700,13 @@ fn load_if_immediate(cx: @block_ctxt, v: ValueRef, t: ty::t) -> ValueRef {
fn trans_log(lvl: @ast::expr, cx: @block_ctxt, e: @ast::expr) -> @block_ctxt {
let ccx = bcx_ccx(cx);
let lcx = cx.fcx.lcx;
let tcx = ccx.tcx;
let modname = str::connect(lcx.module_path, "::");
if ty::type_is_bot(tcx, ty::expr_ty(tcx, lvl)) {
ret trans_expr(cx, lvl, ignore);
}
let global = if lcx.ccx.module_data.contains_key(modname) {
lcx.ccx.module_data.get(modname)
} else {

View File

@ -0,0 +1,4 @@
// error-pattern:roflcopter
fn main() {
log (fail "roflcopter", 2);
}