Machine types are different from int/uint, etc (Issue #2187)

This commit is contained in:
Eric Holk 2012-06-04 17:26:17 -07:00
parent 5f904d278f
commit 1e8f501343
24 changed files with 200 additions and 131 deletions

View file

@ -3,7 +3,7 @@ import syntax::ast::*;
// FIXME this doesn't handle big integer/float literals correctly (nor does
// the rest of our literal handling)
enum const_val {
const_float(float),
const_float(f64),
const_int(i64),
const_uint(u64),
const_str(str),
@ -111,7 +111,7 @@ fn lit_to_const(lit: @lit) -> const_val {
lit_str(s) { const_str(s) }
lit_int(n, _) { const_int(n) }
lit_uint(n, _) { const_uint(n) }
lit_float(n, _) { const_float(option::get(float::from_str(n))) }
lit_float(n, _) { const_float(option::get(float::from_str(n)) as f64) }
lit_nil { const_int(0i64) }
lit_bool(b) { const_int(b as i64) }
}

View file

@ -1406,11 +1406,20 @@ fn super_tys<C:combine>(
b.to_str(self.infcx())]);
}
(ty::ty_nil, _) |
(ty::ty_bool, _) |
(ty::ty_int(_), _) |
(ty::ty_uint(_), _) |
(ty::ty_float(_), _) |
(ty::ty_float(_), _) {
let as = ty::get(a).struct;
let bs = ty::get(b).struct;
if as == bs {
ok(a)
} else {
err(ty::terr_sorts(b, a))
}
}
(ty::ty_nil, _) |
(ty::ty_bool, _) |
(ty::ty_str, _) {
let cfg = tcx.sess.targ_cfg;
if ty::mach_sty(cfg, a) == ty::mach_sty(cfg, b) {