Move ppaux::ty_to_str to new record syntax

This commit is contained in:
Marijn Haverbeke 2011-08-02 11:42:29 +02:00
parent 8d8ff16dfe
commit 043d95a2bd
4 changed files with 5 additions and 5 deletions

View file

@ -65,7 +65,7 @@ fn ty_to_str(cx: &ctxt, typ: &t) -> str {
m.output, m.cf, m.constrs) + ";";
}
fn field_to_str(cx: &ctxt, f: &field) -> str {
ret mt_to_str(cx, f.mt) + " " + f.ident;
ret f.ident + ": " + mt_to_str(cx, f.mt);
}
fn mt_to_str(cx: &ctxt, m: &mt) -> str {
let mstr;
@ -100,7 +100,7 @@ fn ty_to_str(cx: &ctxt, typ: &t) -> str {
ty_rec(elems) {
let strs: str[] = ~[];
for fld: field in elems { strs += ~[field_to_str(cx, fld)]; }
s += "rec(" + str::connect_ivec(strs, ",") + ")";
s += "{" + str::connect_ivec(strs, ",") + "}";
}
ty_tag(id, tps) {
// The user should never see this if the cname is set properly!

View file

@ -1,4 +1,4 @@
// xfail-stage0
// error-pattern:+ cannot be applied to type `rec(bool x)`
// error-pattern:+ cannot be applied to type `{x: bool}`
fn main() { let x = {x: true}; x += {x: false}; }

View file

@ -1,4 +1,4 @@
// xfail-stage0
// error-pattern:+ cannot be applied to type `rec(bool x)`
// error-pattern:+ cannot be applied to type `{x: bool}`
fn main() { let x = {x: true} + {x: false}; }

View file

@ -1,3 +1,3 @@
// xfail-stage0
// error-pattern:Wrong type in main function: found fn(rec(int x
// error-pattern:Wrong type in main function: found fn(
fn main(foo: {x: int, y: int}) { }