mirror of
https://github.com/golang/go
synced 2024-09-05 07:54:46 +00:00
[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 <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
fc9e64cc98
commit
90b6e72605
|
@ -778,7 +778,7 @@ func (check *Checker) collectParams(scope *Scope, list []*syntax.Field, type0 sy
|
||||||
named = true
|
named = true
|
||||||
} else {
|
} else {
|
||||||
// anonymous parameter
|
// anonymous parameter
|
||||||
par := NewParam(ftype.Pos(), check.pkg, "", typ)
|
par := NewParam(field.Pos(), check.pkg, "", typ)
|
||||||
check.recordImplicit(field, par)
|
check.recordImplicit(field, par)
|
||||||
params = append(params, par)
|
params = append(params, par)
|
||||||
anonymous = true
|
anonymous = true
|
||||||
|
|
Loading…
Reference in a new issue