Skip to content

Commit 155ca7f

Browse files
committed
Address pull request comments.
I tried to fixup original comments to keep the history tidier, but that generated far too many merge conflicts than it's worth. Let it be my lesson for why pull requests shall be of a modest size.
1 parent 8a80f06 commit 155ca7f

File tree

7 files changed

+15
-18
lines changed

7 files changed

+15
-18
lines changed

compiler/internal/typeparams/collect.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ func NewResolver(tc *types.Context, tParams []*types.TypeParam, tArgs []types.Ty
2424
subster: subst.New(tc, tParams, tArgs),
2525
selMemo: map[typesutil.Selection]typesutil.Selection{},
2626
}
27-
if len(tParams) != len(tArgs) {
28-
panic(fmt.Errorf("len(tParams)=%d not equal len(tArgs)=%d", len(tParams), len(tArgs)))
29-
}
3027
return r
3128
}
3229

@@ -86,7 +83,7 @@ func (r *Resolver) SubstituteSelection(sel typesutil.Selection) typesutil.Select
8683
}
8784
}
8885

89-
// ToSlice converts TypeParamList into a slice with the sale order of entries.
86+
// ToSlice converts TypeParamList into a slice with the same order of entries.
9087
func ToSlice(tpl *types.TypeParamList) []*types.TypeParam {
9188
result := make([]*types.TypeParam, tpl.Len())
9289
for i := range result {
@@ -214,7 +211,7 @@ func (c *seedVisitor) Visit(n ast.Node) ast.Visitor {
214211
// InstanceSet may contain unprocessed instances of generic types and functions,
215212
// which will be also scanned, for example found in depending packages.
216213
//
217-
// Note that instanced of generic type methods are automatically added to the
214+
// Note that instances of generic type methods are automatically added to the
218215
// set whenever their receiver type instance is encountered.
219216
type Collector struct {
220217
TContext *types.Context

compiler/internal/typeparams/instance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (iset *InstanceSet) Add(instances ...Instance) *InstanceSet {
9494
// In order to have an ID assigned, the instance must have been previously added
9595
// to the set.
9696
//
97-
// Note: we these ids are used in the generated code as keys to the specific
97+
// Note: these ids are used in the generated code as keys to the specific
9898
// type/function instantiation in the type/function object. Using this has two
9999
// advantages:
100100
//

compiler/package.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ func Compile(importPath string, files []*ast.File, fileSet *token.FileSet, impor
399399
if fun.Recv == nil {
400400
// Auxiliary decl shared by all instances of the function that defines
401401
// package-level variable by which they all are referenced.
402-
// TODO(nevkontakte): Set DCE attributes such that it is eliminated of all
402+
// TODO(nevkontakte): Set DCE attributes such that it is eliminated if all
403403
// instances are dead.
404404
varDecl := Decl{}
405405
varDecl.Vars = []string{funcCtx.objectName(o)}

compiler/typesutil/typenames.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type TypeNames struct {
1010
order []*types.TypeName
1111
}
1212

13-
// Add a type name to the test. If the type name has been previously added,
13+
// Add a type name to the set. If the type name has been previously added,
1414
// this operation is a no-op. Two type names are considered equal iff they have
1515
// the same memory address.
1616
func (tn *TypeNames) Add(name *types.TypeName) {

compiler/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func isPkgLevel(o types.Object) bool {
336336
}
337337

338338
// assignedObjectName checks if the object has been previously assigned a name
339-
// in this or one of the parent contexts. If not, found will be false false.
339+
// in this or one of the parent contexts. If not, found will be false.
340340
func (fc *funcContext) assignedObjectName(o types.Object) (name string, found bool) {
341341
if fc == nil {
342342
return "", false

internal/testingx/must.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ package testingx
33

44
import "testing"
55

6-
// Must provides a concise way to handle handle returned error in tests that
6+
// Must provides a concise way to handle returned error in cases that
77
// "should never happen"©.
88
//
99
// This function can be used in test case setup that can be presumed to be
1010
// correct, but technically may return an error. This function MUST NOT be used
11-
// to check for test case conditions themselves because it provides a generic,
11+
// to check for test case conditions themselves because it generates a generic,
1212
// nondescript test error message.
1313
//
1414
// func startServer(addr string) (*server, err)

tests/gorepo/run.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ func (t *test) goDirName() string {
464464
return filepath.Join(t.dir, strings.Replace(t.gofile, ".go", ".dir", -1))
465465
}
466466

467-
func goDirFiles(longdir string) (filter []os.FileInfo, err error) {
468-
files, dirErr := ioutil.ReadDir(longdir)
467+
func goDirFiles(longdir string) (filter []os.DirEntry, err error) {
468+
files, dirErr := os.ReadDir(longdir)
469469
if dirErr != nil {
470470
return nil, dirErr
471471
}
@@ -488,7 +488,7 @@ func goDirPackages(longdir string) ([][]string, error) {
488488
m := make(map[string]int)
489489
for _, file := range files {
490490
name := file.Name()
491-
data, err := ioutil.ReadFile(filepath.Join(longdir, name))
491+
data, err := os.ReadFile(filepath.Join(longdir, name))
492492
if err != nil {
493493
return nil, err
494494
}
@@ -600,7 +600,7 @@ func (t *test) run() {
600600
return
601601
}
602602

603-
srcBytes, err := ioutil.ReadFile(t.goFileName())
603+
srcBytes, err := os.ReadFile(t.goFileName())
604604
if err != nil {
605605
t.err = err
606606
return
@@ -955,7 +955,7 @@ func (t *test) expectedOutput() string {
955955
filename := filepath.Join(t.dir, t.gofile)
956956
filename = filename[:len(filename)-len(".go")]
957957
filename += ".out"
958-
b, _ := ioutil.ReadFile(filename)
958+
b, _ := os.ReadFile(filename)
959959
return string(b)
960960
}
961961

@@ -1047,7 +1047,7 @@ func (t *test) errorCheck(outStr string, fullshort ...string) (err error) {
10471047

10481048
func (t *test) updateErrors(out string, file string) {
10491049
// Read in source file.
1050-
src, err := ioutil.ReadFile(file)
1050+
src, err := os.ReadFile(file)
10511051
if err != nil {
10521052
fmt.Fprintln(os.Stderr, err)
10531053
return
@@ -1159,7 +1159,7 @@ var (
11591159
func (t *test) wantedErrors(file, short string) (errs []wantedError) {
11601160
cache := make(map[string]*regexp.Regexp)
11611161

1162-
src, _ := ioutil.ReadFile(file)
1162+
src, _ := os.ReadFile(file)
11631163
for i, line := range strings.Split(string(src), "\n") {
11641164
lineNum := i + 1
11651165
if strings.Contains(line, "////") {

0 commit comments

Comments
 (0)