diff --git a/src/cmd/compile/internal/gc/noder.go b/src/cmd/compile/internal/gc/noder.go index 3cfd1cad20aa9d..2fdea7cfc83025 100644 --- a/src/cmd/compile/internal/gc/noder.go +++ b/src/cmd/compile/internal/gc/noder.go @@ -1053,7 +1053,12 @@ func (p *noder) wrapname(n syntax.Node, x *Node) *Node { // These nodes do not carry line numbers. // Introduce a wrapper node to give them the correct line. switch x.Op { - case ONAME, ONONAME, OTYPE, OPACK, OLITERAL: + case OTYPE, OLITERAL: + if x.Sym == nil { + break + } + fallthrough + case ONAME, ONONAME, OPACK: x = p.nod(n, OPAREN, x, nil) x.Implicit = true } diff --git a/src/cmd/compile/internal/gc/subr.go b/src/cmd/compile/internal/gc/subr.go index a73be08ebaedf4..555f27e2b0190d 100644 --- a/src/cmd/compile/internal/gc/subr.go +++ b/src/cmd/compile/internal/gc/subr.go @@ -202,10 +202,10 @@ func setlineno(n *Node) int32 { lno := lineno if n != nil { switch n.Op { - case ONAME, OTYPE, OPACK: + case ONAME, OPACK: break - case OLITERAL: + case OLITERAL, OTYPE: if n.Sym != nil { break }