Use the _ representation for integral variables as well

This commit is contained in:
Jakub Bukaj 2014-10-30 21:17:06 +01:00
parent cac995444b
commit a2624fc908
6 changed files with 7 additions and 8 deletions

View File

@ -376,9 +376,8 @@ pub fn ty_to_string(cx: &ctxt, typ: t) -> String {
format!("_#{}i", vid),
ty::FloatVar(ty::FloatVid { index: vid }) if print_var_ids =>
format!("_#{}f", vid),
ty::TyVar(_) => "_".to_string(),
ty::IntVar(_) => "_#i".to_string(),
ty::FloatVar(_) => "_#f".to_string(),
ty::TyVar(_) | ty::IntVar(_) | ty::FloatVar(_) =>
"_".to_string(),
ty::SkolemizedTy(v) => format!("SkolemizedTy({})", v),
ty::SkolemizedIntTy(v) => format!("SkolemizedIntTy({})", v)
}

View File

@ -12,7 +12,7 @@ fn main() {
let x = [1,2];
let y = match x {
[] => None,
//~^ ERROR types: expected `[_#i, ..2]`, found `[_, ..0]`
//~^ ERROR types: expected `[_, ..2]`, found `[_, ..0]`
// (expected array of 2 elements, found array of 0 elements)
[a,_] => Some(a)
};

View File

@ -12,7 +12,7 @@ fn main() {
let a = if true {
0
} else if false {
//~^ ERROR if may be missing an else clause: expected `()`, found `_#i`
//~^ ERROR if may be missing an else clause: expected `()`, found `_`
1
};
}

View File

@ -13,6 +13,6 @@
const A: (int,int) = (4,2);
fn main() {
match 42 { A => () }
//~^ ERROR mismatched types: expected `_#i`, found `(int, int)`
//~^ ERROR mismatched types: expected `_`, found `(int, int)`
// (expected integral variable, found tuple)
}

View File

@ -18,7 +18,7 @@ fn main() {
let c = [0, ..true]; //~ ERROR expected positive integer for repeat count, found boolean
//~^ ERROR: expected `uint`, found `bool`
let d = [0, ..0.5]; //~ ERROR expected positive integer for repeat count, found float
//~^ ERROR: expected `uint`, found `_#f`
//~^ ERROR: expected `uint`, found `_`
let e = [0, .."foo"]; //~ ERROR expected positive integer for repeat count, found string
//~^ ERROR: expected `uint`, found `&'static str`
let f = [0, ..-4];

View File

@ -13,7 +13,7 @@ struct Foo<T,U>(T);
fn main() {
match Foo(1.1) {
1 => {}
//~^ ERROR expected `Foo<_#f, _>`, found `_#i`
//~^ ERROR expected `Foo<_, _>`, found `_`
}
}