]> git.lizzy.rs Git - rust.git/commitdiff
Fix pretty-printing of ty params in iface methods
authorMarijn Haverbeke <marijnh@gmail.com>
Fri, 6 Jan 2012 09:36:55 +0000 (10:36 +0100)
committerMarijn Haverbeke <marijnh@gmail.com>
Fri, 6 Jan 2012 16:40:05 +0000 (17:40 +0100)
src/comp/syntax/print/pprust.rs
src/test/run-pass/iface-generic.rs

index e1a0151a627186302bce163c2a28c5e4087e058d..3e9eab79281195fb3d8d2b10bcfd837229749a5a 100644 (file)
@@ -306,7 +306,7 @@ fn print_field(s: ps, f: ast::ty_field) {
         pclose(s);
       }
       ast::ty_fn(proto, d) {
-        print_ty_fn(s, proto, d, none::<str>);
+        print_ty_fn(s, proto, d, none, none);
       }
       ast::ty_obj(methods) {
         head(s, "obj");
@@ -519,7 +519,7 @@ fn print_ty_method(s: ps, m: ast::ty_method) {
     hardbreak_if_not_bol(s);
     cbox(s, indent_unit);
     maybe_print_comment(s, m.span.lo);
-    print_ty_fn(s, ast::proto_bare, m.decl, some(m.ident));
+    print_ty_fn(s, ast::proto_bare, m.decl, some(m.ident), some(m.tps));
     word(s.s, ";");
     end(s);
 }
@@ -1399,10 +1399,12 @@ fn print_mt(s: ps, mt: ast::mt) {
 }
 
 fn print_ty_fn(s: ps, proto: ast::proto,
-               decl: ast::fn_decl, id: option::t<ast::ident>) {
+               decl: ast::fn_decl, id: option::t<ast::ident>,
+               tps: option::t<[ast::ty_param]>) {
     ibox(s, indent_unit);
     word(s.s, proto_to_str(proto));
     alt id { some(id) { word(s.s, " "); word(s.s, id); } _ { } }
+    alt tps { some(tps) { print_type_params(s, tps); } _ { } }
     zerobreak(s.s);
     popen(s);
     fn print_arg(s: ps, input: ast::arg) {
index 4ac80490b78d15350bde4ad43f0fecd76dd2ee43..2286642cda11152f4dd928d6159120008ed2eca9 100644 (file)
@@ -1,5 +1,3 @@
-// xfail-pretty
-
 iface to_str {
     fn to_str() -> str;
 }