Skip to content

Commit aff536e

Browse files
committed
Fix bad float-type detection in trans
Closes #1017
1 parent ae7bdc2 commit aff536e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/comp/middle/trans.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,7 +2197,7 @@ fn trans_unary(bcx: @block_ctxt, op: ast::unop, e: @ast::expr,
21972197
}
21982198
ast::neg. {
21992199
let {bcx, val} = trans_temp_expr(bcx, e);
2200-
let neg = if ty::struct(bcx_tcx(bcx), e_ty) == ty::ty_float {
2200+
let neg = if ty::type_is_fp(bcx_tcx(bcx), e_ty) {
22012201
FNeg(bcx, val)
22022202
} else { Neg(bcx, val) };
22032203
ret store_in_dest(bcx, neg, dest);
@@ -2287,14 +2287,10 @@ fn trans_eager_binop(cx: @block_ctxt, op: ast::binop, lhs: ValueRef,
22872287
lhs_t: ty::t, rhs: ValueRef, rhs_t: ty::t, dest: dest)
22882288
-> @block_ctxt {
22892289
if dest == ignore { ret cx; }
2290-
let is_float = false;
22912290
let intype = lhs_t;
22922291
if ty::type_is_bot(bcx_tcx(cx), intype) { intype = rhs_t; }
2292+
let is_float = ty::type_is_fp(bcx_tcx(cx), intype);
22932293

2294-
alt ty::struct(bcx_tcx(cx), intype) {
2295-
ty::ty_float. { is_float = true; }
2296-
_ { is_float = false; }
2297-
}
22982294
if op == ast::add && ty::type_is_sequence(bcx_tcx(cx), intype) {
22992295
ret tvec::trans_add(cx, intype, lhs, rhs, dest);
23002296
}

0 commit comments

Comments
 (0)