diff --git a/src/cmd/compile/internal/types2/expr.go b/src/cmd/compile/internal/types2/expr.go index 1afdee2d4d2..30fa05673cd 100644 --- a/src/cmd/compile/internal/types2/expr.go +++ b/src/cmd/compile/internal/types2/expr.go @@ -1127,7 +1127,7 @@ func (check *Checker) exprInternal(T *target, x *operand, e syntax.Expr, hint Ty // Set the Scope's extent to the complete "func (...) {...}" // so that Scope.Innermost works correctly. sig.scope.pos = e.Pos() - sig.scope.end = syntax.EndPos(e) + sig.scope.end = endPos(e) if !check.conf.IgnoreFuncBodies && e.Body != nil { // Anonymous functions are considered part of the // init expression/func declaration which contains diff --git a/src/go/types/expr.go b/src/go/types/expr.go index 55d38609963..ebc662e9663 100644 --- a/src/go/types/expr.go +++ b/src/go/types/expr.go @@ -1105,7 +1105,7 @@ func (check *Checker) exprInternal(T *target, x *operand, e ast.Expr, hint Type) // Set the Scope's extent to the complete "func (...) {...}" // so that Scope.Innermost works correctly. sig.scope.pos = e.Pos() - sig.scope.end = e.End() + sig.scope.end = endPos(e) if !check.conf.IgnoreFuncBodies && e.Body != nil { // Anonymous functions are considered part of the // init expression/func declaration which contains