diff --git a/src/cmd/compile/internal/syntax/printer.go b/src/cmd/compile/internal/syntax/printer.go index 1c0bfc190ec..4b95ae54cc7 100644 --- a/src/cmd/compile/internal/syntax/printer.go +++ b/src/cmd/compile/internal/syntax/printer.go @@ -886,10 +886,12 @@ func (p *printer) printSignature(sig *FuncType) { if list := sig.ResultList; list != nil { p.print(blank) if len(list) == 1 && list[0].Name == nil { - p.printNode(list[0].Type) - } else { - p.printParameterList(list, 0) + if _, ok := list[0].Type.(*DotsType); !ok { + p.printNode(list[0].Type) + return + } } + p.printParameterList(list, 0) } } diff --git a/src/cmd/compile/internal/syntax/printer_test.go b/src/cmd/compile/internal/syntax/printer_test.go index 22585dfd259..d226558be1b 100644 --- a/src/cmd/compile/internal/syntax/printer_test.go +++ b/src/cmd/compile/internal/syntax/printer_test.go @@ -140,6 +140,8 @@ var stringTests = [][2]string{ {"package p; type _[P ((C)),] int", "package p; type _[P C] int"}, {"package p; type _[P, Q ((C))] int", "package p; type _[P, Q C] int"}, + dup("package A; func A() (...A)"), + // TODO(gri) expand }