From bbe3eef04b273f22caf18fb70322f8f445981319 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Fri, 20 Apr 2018 14:19:09 +1000 Subject: [PATCH] Clarify a method TypeExpr's string form --- lang/ast/string.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lang/ast/string.go b/lang/ast/string.go index 0905b4c6..432124b0 100644 --- a/lang/ast/string.go +++ b/lang/ast/string.go @@ -225,8 +225,11 @@ func (n *TypeExpr) appendStr(buf []byte, tm *t.Map, depth uint32) []byte { return n.Inner().appendStr(buf, tm, depth) case t.IDOpenParen: buf = append(buf, "func "...) - buf = n.Receiver().appendStr(buf, tm, depth) - buf = append(buf, '.') + if r := n.Receiver(); r != nil { + buf = append(buf, '(') + buf = r.appendStr(buf, tm, depth) + buf = append(buf, ")."...) + } return append(buf, n.FuncName().Str(tm)...) default: return append(buf, "!invalid_type!"...)