Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package gopls for openSUSE:Factory checked in at 2023-08-13 19:17:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gopls (Old) and /work/SRC/openSUSE:Factory/.gopls.new.11712 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gopls" Sun Aug 13 19:17:49 2023 rev:3 rq:1103616 version:0.13.1 Changes: -------- --- /work/SRC/openSUSE:Factory/gopls/gopls.changes 2023-08-01 14:16:31.939840969 +0200 +++ /work/SRC/openSUSE:Factory/.gopls.new.11712/gopls.changes 2023-08-13 19:18:00.928128781 +0200 @@ -1,0 +2,13 @@ +Sat Aug 12 13:48:30 UTC 2023 - [email protected] + +- Update to version 0.13.1: + * gopls: update go.mod for v0.13.1-pre.2 + * gopls/internal/hooks: clean language version before passing to gofumpt + * gopls/internal/lsp/analysis: fix stubmethods with variadic parameters + * gopls: update go.mod for v0.13.1-pre.1 + * gopls/internal/lsp/source: reinstate equalOrigin for references check + * gopls/internal/lsp/source: fix incorrect 'origin' logic for named types + * gopls/internal/lsp/source: fix renaming of type parameters + * gopls/internal/lsp/source: refresh embeddirective analyzer docs + +------------------------------------------------------------------- Old: ---- gopls-0.13.0.tar.gz New: ---- gopls-0.13.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gopls.spec ++++++ --- /var/tmp/diff_new_pack.5Sy3Ib/_old 2023-08-13 19:18:02.248137227 +0200 +++ /var/tmp/diff_new_pack.5Sy3Ib/_new 2023-08-13 19:18:02.252137252 +0200 @@ -17,7 +17,7 @@ Name: gopls -Version: 0.13.0 +Version: 0.13.1 Release: 0 Summary: Go LSP protocol language server License: BSD-3-Clause ++++++ _service ++++++ --- /var/tmp/diff_new_pack.5Sy3Ib/_old 2023-08-13 19:18:02.292137508 +0200 +++ /var/tmp/diff_new_pack.5Sy3Ib/_new 2023-08-13 19:18:02.296137534 +0200 @@ -4,7 +4,7 @@ <param name="scm">git</param> <param name="include">gopls</param> <param name="include">LICENSE</param> - <param name="revision">gopls/v0.13.0</param> + <param name="revision">gopls/v0.13.1</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="versionrewrite-pattern">gopls/v(.*)</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.5Sy3Ib/_old 2023-08-13 19:18:02.320137688 +0200 +++ /var/tmp/diff_new_pack.5Sy3Ib/_new 2023-08-13 19:18:02.324137713 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/golang/tools.git</param> - <param name="changesrevision">0d76b522a598a5fec760eee7c20049e6d1720ef9</param></service></servicedata> + <param name="changesrevision">6888018a4a5fcc03b1c31df9ebaca094648b175b</param></service></servicedata> (No newline at EOF) ++++++ gopls-0.13.0.tar.gz -> gopls-0.13.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/doc/analyzers.md new/gopls-0.13.1/gopls/doc/analyzers.md --- old/gopls-0.13.0/gopls/doc/analyzers.md 2023-07-27 21:24:08.000000000 +0200 +++ new/gopls-0.13.1/gopls/doc/analyzers.md 2023-08-01 19:24:57.000000000 +0200 @@ -141,10 +141,14 @@ ## **embed** -check for //go:embed directive import +check //go:embed directive usage -This analyzer checks that the embed package is imported when source code contains //go:embed comment directives. -The embed package must be imported for //go:embed directives to function.import _ "embed". +This analyzer checks that the embed package is imported if //go:embed +directives are present, providing a suggested fix to add the import if +it is missing. + +This analyzer also checks that //go:embed directives precede the +declaration of a single variable. **Enabled by default.** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/go.mod new/gopls-0.13.1/gopls/go.mod --- old/gopls-0.13.0/gopls/go.mod 2023-07-27 21:24:08.000000000 +0200 +++ new/gopls-0.13.1/gopls/go.mod 2023-08-01 19:24:57.000000000 +0200 @@ -11,7 +11,7 @@ golang.org/x/sync v0.3.0 golang.org/x/sys v0.10.0 golang.org/x/text v0.11.0 - golang.org/x/tools v0.11.1-0.20230727183555-65b14ec44dc9 + golang.org/x/tools v0.11.2-0.20230801165449-23c7f589706c golang.org/x/vuln v0.0.0-20230110180137-6ad3e3d07815 gopkg.in/yaml.v3 v3.0.1 honnef.co/go/tools v0.4.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/go.sum new/gopls-0.13.1/gopls/go.sum --- old/gopls-0.13.0/gopls/go.sum 2023-07-27 21:24:08.000000000 +0200 +++ new/gopls-0.13.1/gopls/go.sum 2023-08-01 19:24:57.000000000 +0200 @@ -122,8 +122,8 @@ golang.org/x/tools v0.4.1-0.20221208213631-3f74d914ae6d/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.4.1-0.20221217013628-b4dfc36097e2/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.11.1-0.20230727183555-65b14ec44dc9 h1:KyJgiheQsNju4tb8D6MzAlWqI0YS5LbPyDgitUfKCZg= -golang.org/x/tools v0.11.1-0.20230727183555-65b14ec44dc9/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= +golang.org/x/tools v0.11.2-0.20230801165449-23c7f589706c h1:YilyjKn3EDn6X+x+kP+4REeEtG3WeM52dJAr7AWzVrQ= +golang.org/x/tools v0.11.2-0.20230801165449-23c7f589706c/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= golang.org/x/vuln v0.0.0-20230110180137-6ad3e3d07815 h1:A9kONVi4+AnuOr1dopsibH6hLi1Huy54cbeJxnq4vmU= golang.org/x/vuln v0.0.0-20230110180137-6ad3e3d07815/go.mod h1:XJiVExZgoZfrrxoTeVsFYrSSk1snhfpOEC95JL+A4T0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/hooks/gofumpt_118.go new/gopls-0.13.1/gopls/internal/hooks/gofumpt_118.go --- old/gopls-0.13.0/gopls/internal/hooks/gofumpt_118.go 2023-07-27 21:24:08.000000000 +0200 +++ new/gopls-0.13.1/gopls/internal/hooks/gofumpt_118.go 2023-08-01 19:24:57.000000000 +0200 @@ -9,6 +9,7 @@ import ( "context" + "fmt" "golang.org/x/tools/gopls/internal/lsp/source" "mvdan.cc/gofumpt/format" @@ -16,9 +17,62 @@ func updateGofumpt(options *source.Options) { options.GofumptFormat = func(ctx context.Context, langVersion, modulePath string, src []byte) ([]byte, error) { + fixedVersion, err := fixLangVersion(langVersion) + if err != nil { + return nil, err + } return format.Source(src, format.Options{ - LangVersion: langVersion, + LangVersion: fixedVersion, ModulePath: modulePath, }) } } + +// fixLangVersion function cleans the input so that gofumpt doesn't panic. It is +// rather permissive, and accepts version strings that aren't technically valid +// in a go.mod file. +// +// More specifically, it looks for an optional 'v' followed by 1-3 +// '.'-separated numbers. The resulting string is stripped of any suffix beyond +// this expected version number pattern. +// +// See also golang/go#61692: gofumpt does not accept the new language versions +// appearing in go.mod files (e.g. go1.21rc3). +func fixLangVersion(input string) (string, error) { + bad := func() (string, error) { + return "", fmt.Errorf("invalid language version syntax %q", input) + } + if input == "" { + return input, nil + } + i := 0 + if input[0] == 'v' { // be flexible about 'v' + i++ + } + // takeDigits consumes ascii numerals 0-9 and reports if at least one was + // consumed. + takeDigits := func() bool { + found := false + for ; i < len(input) && '0' <= input[i] && input[i] <= '9'; i++ { + found = true + } + return found + } + if !takeDigits() { // versions must start with at least one number + return bad() + } + + // Accept optional minor and patch versions. + for n := 0; n < 2; n++ { + if i < len(input) && input[i] == '.' { + // Look for minor/patch version. + i++ + if !takeDigits() { + i-- + break + } + } + } + // Accept any suffix. + return input[:i], nil +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/hooks/gofumpt_118_test.go new/gopls-0.13.1/gopls/internal/hooks/gofumpt_118_test.go --- old/gopls-0.13.0/gopls/internal/hooks/gofumpt_118_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/gopls-0.13.1/gopls/internal/hooks/gofumpt_118_test.go 2023-08-01 19:24:57.000000000 +0200 @@ -0,0 +1,53 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.18 +// +build go1.18 + +package hooks + +import "testing" + +func TestFixLangVersion(t *testing.T) { + tests := []struct { + input, want string + wantErr bool + }{ + {"", "", false}, + {"1.18", "1.18", false}, + {"v1.18", "v1.18", false}, + {"1.21", "1.21", false}, + {"1.21rc3", "1.21", false}, + {"1.21.0", "1.21.0", false}, + {"1.21.1", "1.21.1", false}, + {"v1.21.1", "v1.21.1", false}, + {"v1.21.0rc1", "v1.21.0", false}, // not technically valid, but we're flexible + {"v1.21.0.0", "v1.21.0", false}, // also technically invalid + {"1.1", "1.1", false}, + {"v1", "v1", false}, + {"1", "1", false}, + {"v1.21.", "v1.21", false}, // also invalid + {"1.21.", "1.21", false}, + + // Error cases. + {"rc1", "", true}, + {"x1.2.3", "", true}, + } + + for _, test := range tests { + got, err := fixLangVersion(test.input) + if test.wantErr { + if err == nil { + t.Errorf("fixLangVersion(%q) succeeded unexpectedly", test.input) + } + continue + } + if err != nil { + t.Fatalf("fixLangVersion(%q) failed: %v", test.input, err) + } + if got != test.want { + t.Errorf("fixLangVersion(%q) = %s, want %s", test.input, got, test.want) + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/lsp/analysis/embeddirective/embeddirective.go new/gopls-0.13.1/gopls/internal/lsp/analysis/embeddirective/embeddirective.go --- old/gopls-0.13.0/gopls/internal/lsp/analysis/embeddirective/embeddirective.go 2023-07-27 21:24:08.000000000 +0200 +++ new/gopls-0.13.1/gopls/internal/lsp/analysis/embeddirective/embeddirective.go 2023-08-01 19:24:57.000000000 +0200 @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Package embeddirective defines an Analyzer that validates //go:embed directives. -// The analyzer defers fixes to it's parent source.Analyzer. +// The analyzer defers fixes to its parent source.Analyzer. package embeddirective import ( @@ -14,10 +14,14 @@ "golang.org/x/tools/go/analysis" ) -const Doc = `check for //go:embed directive import +const Doc = `check //go:embed directive usage -This analyzer checks that the embed package is imported when source code contains //go:embed comment directives. -The embed package must be imported for //go:embed directives to function.import _ "embed".` +This analyzer checks that the embed package is imported if //go:embed +directives are present, providing a suggested fix to add the import if +it is missing. + +This analyzer also checks that //go:embed directives precede the +declaration of a single variable.` var Analyzer = &analysis.Analyzer{ Name: "embed", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/lsp/analysis/stubmethods/stubmethods.go new/gopls-0.13.1/gopls/internal/lsp/analysis/stubmethods/stubmethods.go --- old/gopls-0.13.0/gopls/internal/lsp/analysis/stubmethods/stubmethods.go 2023-07-27 21:24:08.000000000 +0200 +++ new/gopls-0.13.1/gopls/internal/lsp/analysis/stubmethods/stubmethods.go 2023-08-01 19:24:57.000000000 +0200 @@ -174,8 +174,19 @@ if !ok { return nil } - sigVar := sig.Params().At(paramIdx) - iface := ifaceObjFromType(sigVar.Type()) + var paramType types.Type + if sig.Variadic() && paramIdx >= sig.Params().Len()-1 { + v := sig.Params().At(sig.Params().Len() - 1) + if s, _ := v.Type().(*types.Slice); s != nil { + paramType = s.Elem() + } + } else if paramIdx < sig.Params().Len() { + paramType = sig.Params().At(paramIdx).Type() + } + if paramType == nil { + return nil // A type error prevents us from determining the param type. + } + iface := ifaceObjFromType(paramType) if iface == nil { return nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/lsp/code_action.go new/gopls-0.13.1/gopls/internal/lsp/code_action.go --- old/gopls-0.13.0/gopls/internal/lsp/code_action.go 2023-07-27 21:24:08.000000000 +0200 +++ new/gopls-0.13.1/gopls/internal/lsp/code_action.go 2023-08-01 19:24:57.000000000 +0200 @@ -12,6 +12,7 @@ "strings" "golang.org/x/tools/go/ast/inspector" + "golang.org/x/tools/gopls/internal/bug" "golang.org/x/tools/gopls/internal/lsp/analysis/fillstruct" "golang.org/x/tools/gopls/internal/lsp/analysis/infertypeargs" "golang.org/x/tools/gopls/internal/lsp/analysis/stubmethods" @@ -198,26 +199,46 @@ if err != nil { return nil, err } - for _, pd := range diagnostics { + for _, pd := range stubMethodsDiagnostics { start, end, err := pgf.RangePos(pd.Range) if err != nil { return nil, err } - if d, ok := stubmethods.DiagnosticForError(pkg.FileSet(), pgf.File, start, end, pd.Message, pkg.GetTypesInfo()); ok { + action, ok, err := func() (_ protocol.CodeAction, _ bool, rerr error) { + // golang/go#61693: code actions were refactored to run outside of the + // analysis framework, but as a result they lost their panic recovery. + // + // Stubmethods "should never fail"", but put back the panic recovery as a + // defensive measure. + defer func() { + if r := recover(); r != nil { + rerr = bug.Errorf("stubmethods panicked: %v", r) + } + }() + d, ok := stubmethods.DiagnosticForError(pkg.FileSet(), pgf.File, start, end, pd.Message, pkg.GetTypesInfo()) + if !ok { + return protocol.CodeAction{}, false, nil + } cmd, err := command.NewApplyFixCommand(d.Message, command.ApplyFixArgs{ URI: protocol.URIFromSpanURI(pgf.URI), Fix: source.StubMethods, Range: pd.Range, }) if err != nil { - return nil, err + return protocol.CodeAction{}, false, err } - actions = append(actions, protocol.CodeAction{ + return protocol.CodeAction{ Title: d.Message, Kind: protocol.QuickFix, Command: &cmd, Diagnostics: []protocol.Diagnostic{pd}, - }) + }, true, nil + }() + if err != nil { + return nil, err + } + if ok { + actions = append(actions, action) } } @@ -387,7 +408,17 @@ return actions, nil } -func refactorRewrite(ctx context.Context, snapshot source.Snapshot, pkg source.Package, pgf *source.ParsedGoFile, fh source.FileHandle, rng protocol.Range) ([]protocol.CodeAction, error) { +func refactorRewrite(ctx context.Context, snapshot source.Snapshot, pkg source.Package, pgf *source.ParsedGoFile, fh source.FileHandle, rng protocol.Range) (_ []protocol.CodeAction, rerr error) { + // golang/go#61693: code actions were refactored to run outside of the + // analysis framework, but as a result they lost their panic recovery. + // + // These code actions should never fail, but put back the panic recovery as a + // defensive measure. + defer func() { + if r := recover(); r != nil { + rerr = bug.Errorf("refactor.rewrite code actions panicked: %v", r) + } + }() start, end, err := pgf.RangePos(rng) if err != nil { return nil, err diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/lsp/debug/info.go new/gopls-0.13.1/gopls/internal/lsp/debug/info.go --- old/gopls-0.13.0/gopls/internal/lsp/debug/info.go 2023-07-27 21:24:08.000000000 +0200 +++ new/gopls-0.13.1/gopls/internal/lsp/debug/info.go 2023-08-01 19:24:57.000000000 +0200 @@ -30,7 +30,7 @@ ) // Version is a manually-updated mechanism for tracking versions. -const Version = "v0.13.0" +const Version = "v0.13.1" // ServerVersion is the format used by gopls to report its version to the // client. This format is structured so that the client can parse it easily. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/lsp/source/api_json.go new/gopls-0.13.1/gopls/internal/lsp/source/api_json.go --- old/gopls-0.13.0/gopls/internal/lsp/source/api_json.go 2023-07-27 21:24:08.000000000 +0200 +++ new/gopls-0.13.1/gopls/internal/lsp/source/api_json.go 2023-08-01 19:24:57.000000000 +0200 @@ -280,7 +280,7 @@ }, { Name: "\"embed\"", - Doc: "check for //go:embed directive import\n\nThis analyzer checks that the embed package is imported when source code contains //go:embed comment directives.\nThe embed package must be imported for //go:embed directives to function.import _ \"embed\".", + Doc: "check //go:embed directive usage\n\nThis analyzer checks that the embed package is imported if //go:embed\ndirectives are present, providing a suggested fix to add the import if\nit is missing.\n\nThis analyzer also checks that //go:embed directives precede the\ndeclaration of a single variable.", Default: "true", }, { @@ -979,7 +979,7 @@ }, { Name: "embed", - Doc: "check for //go:embed directive import\n\nThis analyzer checks that the embed package is imported when source code contains //go:embed comment directives.\nThe embed package must be imported for //go:embed directives to function.import _ \"embed\".", + Doc: "check //go:embed directive usage\n\nThis analyzer checks that the embed package is imported if //go:embed\ndirectives are present, providing a suggested fix to add the import if\nit is missing.\n\nThis analyzer also checks that //go:embed directives precede the\ndeclaration of a single variable.", Default: true, }, { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/lsp/source/references.go new/gopls-0.13.1/gopls/internal/lsp/source/references.go --- old/gopls-0.13.0/gopls/internal/lsp/source/references.go 2023-07-27 21:24:08.000000000 +0200 +++ new/gopls-0.13.1/gopls/internal/lsp/source/references.go 2023-08-01 19:24:57.000000000 +0200 @@ -580,9 +580,12 @@ // matches reports whether obj either is or corresponds to a target. // (Correspondence is defined as usual for interface methods.) matches := func(obj types.Object) bool { - if targets[obj] { - return true - } else if methodRecvs != nil && obj.Name() == methodName { + for target := range targets { + if equalOrigin(obj, target) { + return true + } + } + if methodRecvs != nil && obj.Name() == methodName { if orecv := effectiveReceiver(obj); orecv != nil { for _, mrecv := range methodRecvs { if concreteImplementsIntf(orecv, mrecv) { @@ -608,6 +611,13 @@ return nil } +// equalOrigin reports whether obj1 and obj2 have equivalent origin object. +// This may be the case even if obj1 != obj2, if one or both of them is +// instantiated. +func equalOrigin(obj1, obj2 types.Object) bool { + return obj1.Pkg() == obj2.Pkg() && obj1.Pos() == obj2.Pos() && obj1.Name() == obj2.Name() +} + // effectiveReceiver returns the effective receiver type for method-set // comparisons for obj, if it is a method, or nil otherwise. func effectiveReceiver(obj types.Object) types.Type { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/lsp/source/rename.go new/gopls-0.13.1/gopls/internal/lsp/source/rename.go --- old/gopls-0.13.0/gopls/internal/lsp/source/rename.go 2023-07-27 21:24:08.000000000 +0200 +++ new/gopls-0.13.1/gopls/internal/lsp/source/rename.go 2023-08-01 19:24:57.000000000 +0200 @@ -343,15 +343,18 @@ // Find objectpath, if object is exported ("" otherwise). var declObjPath objectpath.Path if obj.Exported() { - // objectpath.For requires the origin of a generic - // function or type, not an instantiation (a bug?). - // Unfortunately we can't call {Func,TypeName}.Origin - // as these are not available in go/[email protected]. - // So we take a scenic route. + // objectpath.For requires the origin of a generic function or type, not an + // instantiation (a bug?). Unfortunately we can't call Func.Origin as this + // is not available in go/[email protected]. So we take a scenic route. + // + // Note that unlike Funcs, TypeNames are always canonical (they are "left" + // of the type parameters, unlike methods). switch obj.(type) { // avoid "obj :=" since cases reassign the var case *types.TypeName: - if named, ok := obj.Type().(*types.Named); ok { - obj = named.Obj() + if _, ok := obj.Type().(*typeparams.TypeParam); ok { + // As with capitalized function parameters below, type parameters are + // local. + goto skipObjectPath } case *types.Func: obj = funcOrigin(obj.(*types.Func)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/regtest/marker/testdata/references/issue61618.txt new/gopls-0.13.1/gopls/internal/regtest/marker/testdata/references/issue61618.txt --- old/gopls-0.13.0/gopls/internal/regtest/marker/testdata/references/issue61618.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/gopls-0.13.1/gopls/internal/regtest/marker/testdata/references/issue61618.txt 2023-08-01 19:24:57.000000000 +0200 @@ -0,0 +1,39 @@ +Regression test for 'references' bug golang/go#61618: +references to instantiated fields were missing. + +-- flags -- +-min_go=go1.18 + +-- go.mod -- +module example.com +go 1.18 + +-- a.go -- +package a + +// This file is adapted from the example in the issue. + +type builder[S ~[]F, F ~string] struct { + name string + elements S //@loc(def, "elements"), refs(def, def, assign, use) + elemData map[F][]ElemData[F] +} + +type ElemData[F ~string] struct { + Name F +} + +type BuilderImpl[S ~[]F, F ~string] struct{ builder[S, F] } + +func NewBuilderImpl[S ~[]F, F ~string](name string) *BuilderImpl[S, F] { + impl := &BuilderImpl[S,F]{ + builder[S, F]{ + name: name, + elements: S{}, //@loc(assign, "elements"), refs(assign, def, assign, use) + elemData: map[F][]ElemData[F]{}, + }, + } + + _ = impl.elements //@loc(use, "elements"), refs(use, def, assign, use) + return impl +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/regtest/marker/testdata/rename/basic.txt new/gopls-0.13.1/gopls/internal/regtest/marker/testdata/rename/basic.txt --- old/gopls-0.13.0/gopls/internal/regtest/marker/testdata/rename/basic.txt 2023-07-27 21:24:08.000000000 +0200 +++ new/gopls-0.13.1/gopls/internal/regtest/marker/testdata/rename/basic.txt 2023-08-01 19:24:57.000000000 +0200 @@ -3,12 +3,28 @@ -- basic.go -- package p -func f(x int) { println(x) } //@rename("x", y, param_x) +func f(x int) { println(x) } //@rename("x", y, xToy) --- @param_x/basic.go -- +-- @xToy/basic.go -- package p -func f(y int) { println(y) } //@rename("x", y, param_x) +func f(y int) { println(y) } //@rename("x", y, xToy) + +-- alias.go -- +package p + +// from golang/go#61625 +type LongNameHere struct{} +type A = LongNameHere //@rename("A", B, AToB) +func Foo() A + +-- @AToB/alias.go -- +package p + +// from golang/go#61625 +type LongNameHere struct{} +type B = LongNameHere //@rename("A", B, AToB) +func Foo() B -- errors.go -- package p diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/regtest/marker/testdata/rename/generics.txt new/gopls-0.13.1/gopls/internal/regtest/marker/testdata/rename/generics.txt --- old/gopls-0.13.0/gopls/internal/regtest/marker/testdata/rename/generics.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/gopls-0.13.1/gopls/internal/regtest/marker/testdata/rename/generics.txt 2023-08-01 19:24:57.000000000 +0200 @@ -0,0 +1,240 @@ +This test exercises various renaming features on generic code. + +Fixed bugs: + +- golang/go#61614: renaming a method of a type in a package that uses type + parameter composite lits used to panic, because previous iterations of the + satisfy analysis did not account for this language feature. + +- golang/go#61635: renaming type parameters did not work when they were + capitalized and the package was imported by another package. + +-- flags -- +-min_go=go1.18 + +-- go.mod -- +module example.com +go 1.20 + +-- a.go -- +package a + +type I int + +func (I) m() {} //@rename("m", M, mToM) + +func _[P ~[]int]() { + _ = P{} +} + +-- @mToM/a.go -- +package a + +type I int + +func (I) M() {} //@rename("m", M, mToM) + +func _[P ~[]int]() { + _ = P{} +} + +-- g.go -- +package a + +type S[P any] struct { //@rename("P", Q, PToQ) + P P + F func(P) P +} + +func F[R any](r R) { + var _ R //@rename("R", S, RToS) +} + +-- @PToQ/g.go -- +package a + +type S[Q any] struct { //@rename("P", Q, PToQ) + P Q + F func(Q) Q +} + +func F[R any](r R) { + var _ R //@rename("R", S, RToS) +} + +-- @RToS/g.go -- +package a + +type S[P any] struct { //@rename("P", Q, PToQ) + P P + F func(P) P +} + +func F[S any](r S) { + var _ S //@rename("R", S, RToS) +} + +-- issue61635/p.go -- +package issue61635 + +type builder[S ~[]F, F ~string] struct { //@rename("S", T, SToT) + name string + elements S + elemData map[F][]ElemData[F] + // other fields... +} + +type ElemData[F ~string] struct { + Name F + // other fields... +} + +type BuilderImpl[S ~[]F, F ~string] struct{ builder[S, F] } + +-- importer/i.go -- +package importer + +import "example.com/issue61635" // importing is necessary to repro golang/go#61635 + +var _ issue61635.ElemData[string] + +-- @SToT/issue61635/p.go -- +package issue61635 + +type builder[T ~[]F, F ~string] struct { //@rename("S", T, SToT) + name string + elements T + elemData map[F][]ElemData[F] + // other fields... +} + +type ElemData[F ~string] struct { + Name F + // other fields... +} + +type BuilderImpl[S ~[]F, F ~string] struct{ builder[S, F] } + +-- instances/type.go -- +package instances + +type R[P any] struct { //@rename("R", u, Rtou) + Next *R[P] //@rename("R", s, RTos) +} + +func (rv R[P]) Do(R[P]) R[P] { //@rename("Do", Do1, DoToDo1) + var x R[P] + return rv.Do(x) //@rename("Do", Do2, DoToDo2) +} + +func _() { + var x R[int] //@rename("R", r, RTor) + x = x.Do(x) +} + +-- @RTos/instances/type.go -- +package instances + +type s[P any] struct { //@rename("R", u, Rtou) + Next *s[P] //@rename("R", s, RTos) +} + +func (rv s[P]) Do(s[P]) s[P] { //@rename("Do", Do1, DoToDo1) + var x s[P] + return rv.Do(x) //@rename("Do", Do2, DoToDo2) +} + +func _() { + var x s[int] //@rename("R", r, RTor) + x = x.Do(x) +} + +-- @Rtou/instances/type.go -- +package instances + +type u[P any] struct { //@rename("R", u, Rtou) + Next *u[P] //@rename("R", s, RTos) +} + +func (rv u[P]) Do(u[P]) u[P] { //@rename("Do", Do1, DoToDo1) + var x u[P] + return rv.Do(x) //@rename("Do", Do2, DoToDo2) +} + +func _() { + var x u[int] //@rename("R", r, RTor) + x = x.Do(x) +} + +-- @DoToDo1/instances/type.go -- +package instances + +type R[P any] struct { //@rename("R", u, Rtou) + Next *R[P] //@rename("R", s, RTos) +} + +func (rv R[P]) Do1(R[P]) R[P] { //@rename("Do", Do1, DoToDo1) + var x R[P] + return rv.Do1(x) //@rename("Do", Do2, DoToDo2) +} + +func _() { + var x R[int] //@rename("R", r, RTor) + x = x.Do1(x) +} + +-- @DoToDo2/instances/type.go -- +package instances + +type R[P any] struct { //@rename("R", u, Rtou) + Next *R[P] //@rename("R", s, RTos) +} + +func (rv R[P]) Do2(R[P]) R[P] { //@rename("Do", Do1, DoToDo1) + var x R[P] + return rv.Do2(x) //@rename("Do", Do2, DoToDo2) +} + +func _() { + var x R[int] //@rename("R", r, RTor) + x = x.Do2(x) +} + +-- instances/func.go -- +package instances + +func Foo[P any](p P) { //@rename("Foo", Bar, FooToBar) + Foo(p) //@rename("Foo", Baz, FooToBaz) +} + +-- @FooToBar/instances/func.go -- +package instances + +func Bar[P any](p P) { //@rename("Foo", Bar, FooToBar) + Bar(p) //@rename("Foo", Baz, FooToBaz) +} + +-- @FooToBaz/instances/func.go -- +package instances + +func Baz[P any](p P) { //@rename("Foo", Bar, FooToBar) + Baz(p) //@rename("Foo", Baz, FooToBaz) +} + +-- @RTor/instances/type.go -- +package instances + +type r[P any] struct { //@rename("R", u, Rtou) + Next *r[P] //@rename("R", s, RTos) +} + +func (rv r[P]) Do(r[P]) r[P] { //@rename("Do", Do1, DoToDo1) + var x r[P] + return rv.Do(x) //@rename("Do", Do2, DoToDo2) +} + +func _() { + var x r[int] //@rename("R", r, RTor) + x = x.Do(x) +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/regtest/marker/testdata/rename/issue61614.txt new/gopls-0.13.1/gopls/internal/regtest/marker/testdata/rename/issue61614.txt --- old/gopls-0.13.0/gopls/internal/regtest/marker/testdata/rename/issue61614.txt 2023-07-27 21:24:08.000000000 +0200 +++ new/gopls-0.13.1/gopls/internal/regtest/marker/testdata/rename/issue61614.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,35 +0,0 @@ -This test renames a method of a type in a package that uses type parameter -composite lits. Previous iterations of the satisfy analysis did not account for -this language feature. - -See issue #60789. - --- flags -- --min_go=go1.18 - --- go.mod -- -module example.com -go 1.20 - --- a.go -- -package a - -type I int - -func (I) m() {} //@rename("m", M, mToM) - -func _[P ~[]int]() { - _ = P{} -} - --- @mToM/a.go -- -package a - -type I int - -func (I) M() {} //@rename("m", M, mToM) - -func _[P ~[]int]() { - _ = P{} -} - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/regtest/marker/testdata/stubmethods/issue61693.txt new/gopls-0.13.1/gopls/internal/regtest/marker/testdata/stubmethods/issue61693.txt --- old/gopls-0.13.0/gopls/internal/regtest/marker/testdata/stubmethods/issue61693.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/gopls-0.13.1/gopls/internal/regtest/marker/testdata/stubmethods/issue61693.txt 2023-08-01 19:24:57.000000000 +0200 @@ -0,0 +1,35 @@ +This test exercises stub methods functionality with variadic parameters. + +In golang/go#61693 stubmethods was panicking in this case. + +-- go.mod -- +module mod.com + +go 1.18 +-- main.go -- +package main + +type C int + +func F(err ...error) {} + +func _() { + var x error + F(x, C(0)) //@suggestedfix(re"C.0.", re"missing method Error", "quickfix", stub) +} +-- @stub/main.go -- +package main + +type C int + +// Error implements error. +func (C) Error() string { + panic("unimplemented") +} + +func F(err ...error) {} + +func _() { + var x error + F(x, C(0)) //@suggestedfix(re"C.0.", re"missing method Error", "quickfix", stub) +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gopls-0.13.0/gopls/internal/regtest/misc/formatting_test.go new/gopls-0.13.1/gopls/internal/regtest/misc/formatting_test.go --- old/gopls-0.13.0/gopls/internal/regtest/misc/formatting_test.go 2023-07-27 21:24:08.000000000 +0200 +++ new/gopls-0.13.1/gopls/internal/regtest/misc/formatting_test.go 2023-08-01 19:24:57.000000000 +0200 @@ -366,3 +366,30 @@ } }) } + +func TestGofumpt_Issue61692(t *testing.T) { + testenv.NeedsGo1Point(t, 21) + + const input = ` +-- go.mod -- +module foo + +go 1.21rc3 +-- foo.go -- +package foo + +func _() { + foo := + "bar" +} +` + + WithOptions( + Settings{ + "gofumpt": true, + }, + ).Run(t, input, func(t *testing.T, env *Env) { + env.OpenFile("foo.go") + env.FormatBuffer("foo.go") // golang/go#61692: must not panic + }) +} ++++++ vendor.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/golang.org/x/tools/internal/gcimporter/iexport.go new/vendor/golang.org/x/tools/internal/gcimporter/iexport.go --- old/vendor/golang.org/x/tools/internal/gcimporter/iexport.go 2023-07-31 16:45:09.000000000 +0200 +++ new/vendor/golang.org/x/tools/internal/gcimporter/iexport.go 2023-08-12 15:48:33.000000000 +0200 @@ -929,10 +929,11 @@ // that export/import is producing a correct package. // // TODO: remove reportf once we have such confidence. - objectPath = "" + w.string("") if w.p.reportf != nil { w.p.reportf("unable to encode object %q in package %q: %v", obj.Name(), obj.Pkg().Path(), err) } + return } w.string(string(objectPath)) w.pkg(obj.Pkg()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/modules.txt new/vendor/modules.txt --- old/vendor/modules.txt 2023-07-31 16:45:09.000000000 +0200 +++ new/vendor/modules.txt 2023-08-12 15:48:33.000000000 +0200 @@ -50,7 +50,7 @@ ## explicit; go 1.17 golang.org/x/text/unicode/rangetable golang.org/x/text/unicode/runenames -# golang.org/x/tools v0.11.1-0.20230727183555-65b14ec44dc9 +# golang.org/x/tools v0.11.2-0.20230801165449-23c7f589706c ## explicit; go 1.18 golang.org/x/tools/cover golang.org/x/tools/go/analysis
