From 6382c39e15ce68996a3848ad6f0ca15570e35ff5 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Tue, 17 May 2022 15:26:18 -0700 Subject: [PATCH] cmd/compile/internal/noder: remove TODO about position handling types2 uses nopos as the position for predeclared objects, so it's expected that we'll see !pos.IsKnown() when translating types2 representations into IR. Change-Id: I8708c2e9815e3dd27da8066c67c73f5586ac4617 Reviewed-on: https://go-review.googlesource.com/c/go/+/406896 Auto-Submit: Matthew Dempsky Run-TryBot: Matthew Dempsky Reviewed-by: Robert Griesemer TryBot-Result: Gopher Robot --- src/cmd/compile/internal/noder/posmap.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/noder/posmap.go b/src/cmd/compile/internal/noder/posmap.go index f22628f845f..6c7e57c9963 100644 --- a/src/cmd/compile/internal/noder/posmap.go +++ b/src/cmd/compile/internal/noder/posmap.go @@ -26,8 +26,9 @@ func (m *posMap) pos(p poser) src.XPos { return m.makeXPos(p.Pos()) } func (m *posMap) end(p ender) src.XPos { return m.makeXPos(p.End()) } func (m *posMap) makeXPos(pos syntax.Pos) src.XPos { + // Predeclared objects (e.g., the result parameter for error.Error) + // do not have a position. if !pos.IsKnown() { - // TODO(mdempsky): Investigate restoring base.Fatalf. return src.NoXPos }