From: Matthew Dempsky Date: Mon, 17 May 2021 21:25:49 +0000 (-0700) Subject: [dev.typeparams] cmd/compile/internal/types2: tweak anonymous parameter position X-Git-Tag: go1.18beta1~1818^2^2~532 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=90b6e7260553a742522830ddd38f5854657f2985;p=gostls13.git [dev.typeparams] cmd/compile/internal/types2: tweak anonymous parameter position When declaring anonymous parameters, use the syntax.Field's Pos directly rather than its Type field's Pos. When the type expression is a qualified identifier (i.e., SelectorExpr), its Pos returns the position of the dot, whereas we typically declare the anonymous parameter at the starting position of the type. (We could equivalently use syntax.StartPos(field.Type), but we already have this as field.Pos().) Change-Id: If6ac9635b6e9c2b75a1989d5893a78e0b21cba88 Reviewed-on: https://go-review.googlesource.com/c/go/+/320611 Trust: Matthew Dempsky Run-TryBot: Matthew Dempsky TryBot-Result: Go Bot Reviewed-by: Robert Griesemer --- diff --git a/src/cmd/compile/internal/types2/typexpr.go b/src/cmd/compile/internal/types2/typexpr.go index e64d804c30..a1663d2aa0 100644 --- a/src/cmd/compile/internal/types2/typexpr.go +++ b/src/cmd/compile/internal/types2/typexpr.go @@ -778,7 +778,7 @@ func (check *Checker) collectParams(scope *Scope, list []*syntax.Field, type0 sy named = true } else { // anonymous parameter - par := NewParam(ftype.Pos(), check.pkg, "", typ) + par := NewParam(field.Pos(), check.pkg, "", typ) check.recordImplicit(field, par) params = append(params, par) anonymous = true