Implement new inference algorithm.

This commit is contained in:
Niko Matsakis 2012-03-22 20:06:01 -07:00
parent 40443768b1
commit 042c532a08
24 changed files with 1002 additions and 123 deletions

View file

@ -28,6 +28,15 @@ fn region_to_str(cx: ctxt, region: region) -> str {
}
}
fn mt_to_str(cx: ctxt, m: mt) -> str {
let mstr = alt m.mutbl {
ast::m_mutbl { "mut " }
ast::m_imm { "" }
ast::m_const { "const " }
};
ret mstr + ty_to_str(cx, m.ty);
}
fn ty_to_str(cx: ctxt, typ: t) -> str {
fn fn_input_to_str(cx: ctxt, input: {mode: ast::mode, ty: t}) ->
str {
@ -72,14 +81,6 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
fn field_to_str(cx: ctxt, f: field) -> str {
ret f.ident + ": " + mt_to_str(cx, f.mt);
}
fn mt_to_str(cx: ctxt, m: mt) -> str {
let mstr = alt m.mutbl {
ast::m_mutbl { "mut " }
ast::m_imm { "" }
ast::m_const { "const " }
};
ret mstr + ty_to_str(cx, m.ty);
}
fn parameterized(cx: ctxt, base: str, tps: [ty::t]) -> str {
if vec::len(tps) > 0u {
let strs = vec::map(tps, {|t| ty_to_str(cx, t)});