don't fail if inference is not complete

This commit is contained in:
Niko Matsakis 2012-02-03 17:10:29 -08:00
parent daf0d63a59
commit 966504c828
2 changed files with 13 additions and 5 deletions

View File

@ -167,6 +167,7 @@ export type_structurally_contains;
export type_structurally_contains_uniques;
export type_autoderef;
export type_param;
export canon_mode;
export resolved_mode;
export arg_mode;
export unify_mode;

View File

@ -12,12 +12,19 @@ import middle::ast_map;
fn ty_to_str(cx: ctxt, typ: t) -> str {
fn fn_input_to_str(cx: ctxt, input: {mode: ast::mode, ty: t}) ->
str {
let arg_mode = ty::arg_mode(cx, input);
let modestr = {
if arg_mode == ty::default_arg_mode_for_ty(cx, input.ty) { "" }
else { mode_to_str(input.mode) }
let {mode, ty} = input;
let modestr = alt canon_mode(cx, mode) {
ast::infer(_) { "" }
ast::expl(m) {
if !ty::type_contains_vars(cx, ty) &&
m == ty::default_arg_mode_for_ty(cx, ty) {
""
} else {
mode_to_str(ast::expl(m))
}
}
};
modestr + ty_to_str(cx, input.ty)
modestr + ty_to_str(cx, ty)
}
fn fn_to_str(cx: ctxt, proto: ast::proto, ident: option<ast::ident>,
inputs: [arg], output: t, cf: ast::ret_style,