internal/typeparams: run go generate with go1.18.2

And fix a minor issue in copytermlist.go --

copytermlist.go replaces type names from go/types with
qualified type names. Use of token.NoPos (filled with
ast.NewIdent) however confuses the go/format printer.
As a result, while transforming

  func (x *term) includes(t Type) bool

to

  func (x *term) includes(t types.Type) bool

go/format printer failed to compute the end position of
the parameter list, concluded RPAREN should be in a
different line from the parameter list, added a comma,
and printed

  func (x *term) includes(t types.Type,) bool

Reuse the replaced node's position instead. (not 100%
correct, but better than NoPos)

Change-Id: Ia34e11562cc80c68dcf4b921ffffd926971c2215
Reviewed-on: https://go-review.googlesource.com/c/tools/+/405536
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
diff --git a/internal/typeparams/copytermlist.go b/internal/typeparams/copytermlist.go
index b8f458a..5357f9d 100644
--- a/internal/typeparams/copytermlist.go
+++ b/internal/typeparams/copytermlist.go
@@ -42,7 +42,7 @@
 			return err
 		}
 		file.Name.Name = "typeparams"
-		file.Doc = &ast.CommentGroup{List: []*ast.Comment{&ast.Comment{Text: "DO NOT MODIFY"}}}
+		file.Doc = &ast.CommentGroup{List: []*ast.Comment{{Text: "DO NOT MODIFY"}}}
 		var needImport bool
 		selectorType := reflect.TypeOf((*ast.SelectorExpr)(nil))
 		astutil.Apply(file, func(c *astutil.Cursor) bool {
@@ -70,8 +70,8 @@
 				}
 				needImport = true
 				c.Replace(&ast.SelectorExpr{
-					X:   ast.NewIdent("types"),
-					Sel: ast.NewIdent(id.Name),
+					X:   &ast.Ident{NamePos: id.NamePos, Name: "types"},
+					Sel: &ast.Ident{NamePos: id.NamePos, Name: id.Name, Obj: id.Obj},
 				})
 			}
 			return true
diff --git a/internal/typeparams/termlist.go b/internal/typeparams/termlist.go
index 10857d5..933106a 100644
--- a/internal/typeparams/termlist.go
+++ b/internal/typeparams/termlist.go
@@ -97,15 +97,6 @@
 	return rl
 }
 
-// If the type set represented by xl is specified by a single (non-š¯“¤) term,
-// structuralType returns that type. Otherwise it returns nil.
-func (xl termlist) structuralType() types.Type {
-	if nl := xl.norm(); len(nl) == 1 {
-		return nl[0].typ // if nl.isAll() then typ is nil, which is ok
-	}
-	return nil
-}
-
 // union returns the union xl ∪ yl.
 func (xl termlist) union(yl termlist) termlist {
 	return append(xl, yl...).norm()
diff --git a/internal/typeparams/typeterm.go b/internal/typeparams/typeterm.go
index 7350bb7..7ddee28 100644
--- a/internal/typeparams/typeterm.go
+++ b/internal/typeparams/typeterm.go
@@ -10,10 +10,11 @@
 
 // A term describes elementary type sets:
 //
-//	 ∅:  (*term)(nil)     == ∅                      // set of no types (empty set)
-//	 š¯“¤:  &term{}          == š¯“¤                      // set of all types (š¯“¤niverse)
-//	 T:  &term{false, T}  == {T}                    // set of type T
-//	~t:  &term{true, t}   == {t' | under(t') == t}  // set of types with underlying type t
+//   ∅:  (*term)(nil)     == ∅                      // set of no types (empty set)
+//   š¯“¤:  &term{}          == š¯“¤                      // set of all types (š¯“¤niverse)
+//   T:  &term{false, T}  == {T}                    // set of type T
+//  ~t:  &term{true, t}   == {t' | under(t') == t}  // set of types with underlying type t
+//
 type term struct {
 	tilde bool // valid if typ != nil
 	typ   types.Type