Skip to content

Commit 3ff6127

Browse files
committed
all: merge master (e8cdaf4) into gopls-release-branch.0.13
For golang/go#61583 Merge List: + 2023-07-26 e8cdaf4 gopls/internal/lsp/cache: fast-path for type-checking active packages + 2023-07-26 da5abd3 gopls/internal/lsp/cache: fix use of time.NewTimer instead of NewTicker + 2023-07-26 b389785 gopls: fix tests that depend on log sequencing + 2023-07-26 2ffc4dc all: fix some typos Change-Id: I7a3de6330a6b6d0dca51de6094603cde2cec1b6a
2 parents 8d454fc + e8cdaf4 commit 3ff6127

File tree

19 files changed

+70
-72
lines changed

19 files changed

+70
-72
lines changed

cmd/compilebench/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,10 @@ func runBuildCmd(name string, count int, dir, tool string, args []string) error
567567
return nil
568568
}
569569

570-
// genSymAbisFile runs the assembler on the target packge asm files
570+
// genSymAbisFile runs the assembler on the target package asm files
571571
// with "-gensymabis" to produce a symabis file that will feed into
572572
// the Go source compilation. This is fairly hacky in that if the
573-
// asm invocation convenion changes it will need to be updated
573+
// asm invocation convention changes it will need to be updated
574574
// (hopefully that will not be needed too frequently).
575575
func genSymAbisFile(pkg *Pkg, symAbisFile, incdir string) error {
576576
args := []string{"-gensymabis", "-o", symAbisFile,

go/analysis/passes/buildssa/testdata/src/c/c.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ func B() {
1919
m := b.G.Load()
2020
f := b.Load(&b.G)
2121
if f != m {
22-
panic("loads of b.G are expected to be indentical")
22+
panic("loads of b.G are expected to be identical")
2323
}
2424
}

go/analysis/passes/errorsas/testdata/src/a/a.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func _() {
2929
ei interface{}
3030
)
3131
errors.As(nil, &e) // want `second argument to errors.As should not be \*error`
32-
errors.As(nil, &m) // *T where T implemements error
32+
errors.As(nil, &m) // *T where T implements error
3333
errors.As(nil, &f) // *interface
3434
errors.As(nil, perr()) // want `second argument to errors.As should not be \*error`
3535
errors.As(nil, ei) // empty interface

go/analysis/passes/errorsas/testdata/src/typeparams/typeparams.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func _[E error](e E) {
2626
tw twice[myError[int]]
2727
)
2828
errors.As(nil, &e)
29-
errors.As(nil, &m) // *T where T implemements error
29+
errors.As(nil, &m) // *T where T implements error
3030
errors.As(nil, &tw.t) // *T where T implements error
3131
errors.As(nil, perr[error]()) // want `second argument to errors.As should not be \*error`
3232

go/ssa/builder_go120_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestBuildPackageGo120(t *testing.T) {
3636
// as []rune, pointers to rune arrays, rune arrays, or strings.
3737
//
3838
// Comments listed given the current emitted instructions [approximately].
39-
// If multiple conversions are needed, these are seperated by |.
39+
// If multiple conversions are needed, these are separated by |.
4040
// rune was selected as it leads to string casts (byte is similar).
4141
// The length 2 is not significant.
4242
// Multiple array lengths may occur in a cast in practice (including 0).

go/ssa/subst.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ func (subst *subster) signature(t *types.Signature) types.Type {
388388
// no type params to substitute
389389
// (2)generic method and recv needs to be substituted.
390390

391-
// Recievers can be either:
391+
// Receivers can be either:
392392
// named
393393
// pointer to named
394394
// interface

go/ssa/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ func (c *canonizer) Type(T types.Type) types.Type {
304304
return T
305305
}
306306

307-
// A type for representating an canonized list of types.
307+
// A type for representing a canonized list of types.
308308
type typeList []types.Type
309309

310310
func (l *typeList) identical(ts []types.Type) bool {

gopls/internal/lsp/analysis/stubmethods/stubmethods.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ type StubInfo struct {
115115
//
116116
// TODO(adonovan): this function (and its following 5 helpers) tries
117117
// to deduce a pair of (concrete, interface) types that are related by
118-
// an assignment, either explictly or through a return statement or
118+
// an assignment, either explicitly or through a return statement or
119119
// function call. This is essentially what the refactor/satisfy does,
120120
// more generally. Refactor to share logic, after auditing 'satisfy'
121121
// for safety on ill-typed code.

gopls/internal/lsp/cache/check.go

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,30 @@ type pkgOrErr struct {
9393
// the type-checking operation.
9494
func (s *snapshot) TypeCheck(ctx context.Context, ids ...PackageID) ([]source.Package, error) {
9595
pkgs := make([]source.Package, len(ids))
96+
97+
var (
98+
needIDs []PackageID // ids to type-check
99+
indexes []int // original index of requested ids
100+
)
101+
102+
// Check for existing active packages, as any package will do.
103+
//
104+
// This is also done inside forEachPackage, but doing it here avoids
105+
// unnecessary set up for type checking (e.g. assembling the package handle
106+
// graph).
107+
for i, id := range ids {
108+
if pkg := s.getActivePackage(id); pkg != nil {
109+
pkgs[i] = pkg
110+
} else {
111+
needIDs = append(needIDs, id)
112+
indexes = append(indexes, i)
113+
}
114+
}
115+
96116
post := func(i int, pkg *Package) {
97-
pkgs[i] = pkg
117+
pkgs[indexes[i]] = pkg
98118
}
99-
return pkgs, s.forEachPackage(ctx, ids, nil, post)
119+
return pkgs, s.forEachPackage(ctx, needIDs, nil, post)
100120
}
101121

102122
// getImportGraph returns a shared import graph use for this snapshot, or nil.

gopls/internal/lsp/cache/parse.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ func fixMissingCurlies(f *ast.File, b *ast.BlockStmt, parent ast.Node, tok *toke
398398
//
399399
// }
400400
//
401-
// The resulting bool reports whether any fixing occured.
401+
// The resulting bool reports whether any fixing occurred.
402402
func fixEmptySwitch(body *ast.BlockStmt, tok *token.File, src []byte) bool {
403403
// We only care about empty switch statements.
404404
if len(body.List) > 0 || !body.Rbrace.IsValid() {
@@ -475,7 +475,7 @@ func fixDanglingSelector(s *ast.SelectorExpr, tf *token.File, src []byte) []byte
475475
//
476476
// TODO(rfindley): should this constitute an ast 'fix'?
477477
//
478-
// The resulting bool reports whether any fixing occured.
478+
// The resulting bool reports whether any fixing occurred.
479479
func fixPhantomSelector(sel *ast.SelectorExpr, tf *token.File, src []byte) bool {
480480
if !isPhantomUnderscore(sel.Sel, tf, src) {
481481
return false
@@ -525,7 +525,7 @@ func isPhantomUnderscore(id *ast.Ident, tok *token.File, src []byte) bool {
525525
// parser is looking for the conditional expression. However, "i := 0"
526526
// are not valid expressions, so we get a BadExpr.
527527
//
528-
// The resulting bool reports whether any fixing occured.
528+
// The resulting bool reports whether any fixing occurred.
529529
func fixInitStmt(bad *ast.BadExpr, parent ast.Node, tok *token.File, src []byte) bool {
530530
if !bad.Pos().IsValid() || !bad.End().IsValid() {
531531
return false

0 commit comments

Comments
 (0)