From 05e596cb5b8a55ca378888c3077e0db55dd8f61f Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Sat, 9 Nov 2024 12:26:46 +0100 Subject: [PATCH] also cmd/compile/internal/syntax Change-Id: If10974dd4c44396f553d1581773e37f045a7d224 --- src/cmd/compile/internal/syntax/printer.go | 8 +++++--- src/cmd/compile/internal/syntax/printer_test.go | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) 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 }