diff --git a/internal/typeparams/copytermlist.go b/internal/typeparams/copytermlist.go index b8f458ac3b..5357f9d2fd 100644 --- a/internal/typeparams/copytermlist.go +++ b/internal/typeparams/copytermlist.go @@ -42,7 +42,7 @@ func doCopy() error { 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 @@ func doCopy() error { } 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 10857d504c..933106a23d 100644 --- a/internal/typeparams/termlist.go +++ b/internal/typeparams/termlist.go @@ -97,15 +97,6 @@ func (xl termlist) norm() termlist { 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 7350bb702a..7ddee28d98 100644 --- a/internal/typeparams/typeterm.go +++ b/internal/typeparams/typeterm.go @@ -10,10 +10,11 @@ import "go/types" // 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