repr: emit closing `)` for enum variants, test that nullary variants names print
This commit is contained in:
parent
e21b48c0ce
commit
e0845eb589
|
@ -508,7 +508,7 @@ impl ReprPrinterWrapper : TyVisitor {
|
|||
_disr_val: int,
|
||||
n_fields: uint,
|
||||
_name: &str) -> bool {
|
||||
if !self.printer.skip && n_fields > 1 {
|
||||
if !self.printer.skip && n_fields >= 1 {
|
||||
self.printer.writer.write_char(')');
|
||||
}
|
||||
true
|
||||
|
|
|
@ -4,8 +4,13 @@ enum foo {
|
|||
c,
|
||||
}
|
||||
|
||||
enum bar {
|
||||
d, e, f
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert ~"a(22)" == fmt!("%?", a(22u));
|
||||
assert ~"b(~\"hi\")" == fmt!("%?", b(~"hi"));
|
||||
assert ~"c" == fmt!("%?", c);
|
||||
assert ~"d" == fmt!("%?", d);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue