Enable integer literal suffix inference.
This commit is contained in:
parent
b1fa8249f1
commit
3cf582b529
@ -626,10 +626,7 @@ fn check_lit(fcx: @fn_ctxt, lit: @ast::lit) -> ty::t {
|
||||
ast::lit_int_unsuffixed(_) {
|
||||
// An unsuffixed integer literal could have any integral type,
|
||||
// so we create an integral type variable for it.
|
||||
ty::mk_var_integral(tcx, fcx.infcx.next_ty_var_integral_id());
|
||||
|
||||
// FIXME: remove me when #1425 is finished.
|
||||
ty::mk_mach_int(tcx, ty_i)
|
||||
ty::mk_var_integral(tcx, fcx.infcx.next_ty_var_integral_id())
|
||||
}
|
||||
ast::lit_float(_, t) { ty::mk_mach_float(tcx, t) }
|
||||
ast::lit_nil { ty::mk_nil(tcx) }
|
||||
|
@ -1,4 +1,3 @@
|
||||
// xfail-test
|
||||
fn main() {
|
||||
|
||||
// the smallest positive values that need these types
|
||||
|
22
src/test/run-pass/inferred-suffix-in-pattern-range.rs
Normal file
22
src/test/run-pass/inferred-suffix-in-pattern-range.rs
Normal file
@ -0,0 +1,22 @@
|
||||
fn main() {
|
||||
let x = 2;
|
||||
let x_message = alt x {
|
||||
0 to 1 { "not many" }
|
||||
_ { "lots" }
|
||||
};
|
||||
assert x_message == "lots";
|
||||
|
||||
let y = 2i;
|
||||
let y_message = alt y {
|
||||
0 to 1 { "not many" }
|
||||
_ { "lots" }
|
||||
};
|
||||
assert y_message == "lots";
|
||||
|
||||
let z = 1u64;
|
||||
let z_message = alt z {
|
||||
0 to 1 { "not many" }
|
||||
_ { "lots" }
|
||||
};
|
||||
assert z_message == "not many";
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
// xfail-test
|
||||
fn main() {
|
||||
|
||||
// The commented-out lines are ones that fail currently. I'm
|
||||
|
Loading…
x
Reference in New Issue
Block a user