Add missed case to typeck.ast_ty_to_ty, plus faux exhaustiveness check.

This commit is contained in:
Graydon Hoare 2010-11-25 17:06:36 -08:00
parent 416d9bc0fd
commit 7e2f205866

View file

@ -225,6 +225,13 @@ fn ast_ty_to_ty(ty_getter getter, &@ast.ty ast_ty) -> @ty {
case (ast.ty_str) { sty = ty_str; } case (ast.ty_str) { sty = ty_str; }
case (ast.ty_box(?t)) { sty = ty_box(ast_ty_to_ty(getter, t)); } case (ast.ty_box(?t)) { sty = ty_box(ast_ty_to_ty(getter, t)); }
case (ast.ty_vec(?t)) { sty = ty_vec(ast_ty_to_ty(getter, t)); } case (ast.ty_vec(?t)) { sty = ty_vec(ast_ty_to_ty(getter, t)); }
case (ast.ty_tup(?fields)) {
let vec[tup(bool,@ty)] flds = vec();
for (tup(bool, @ast.ty) field in fields) {
flds += tup(field._0, ast_ty_to_ty(getter, field._1));
}
sty = ty_tup(flds);
}
case (ast.ty_fn(?inputs, ?output)) { case (ast.ty_fn(?inputs, ?output)) {
auto f = bind ast_arg_to_arg(getter, _); auto f = bind ast_arg_to_arg(getter, _);
@ -244,6 +251,10 @@ fn ast_ty_to_ty(ty_getter getter, &@ast.ty ast_ty) -> @ty {
sty = getter(def_id).struct; sty = getter(def_id).struct;
cname = some(path_to_str(path)); cname = some(path_to_str(path));
} }
case (_) {
fail;
}
} }
ret @rec(struct=sty, cname=cname); ret @rec(struct=sty, cname=cname);