aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/subst.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-04-13 17:48:45 -0700
committerRobert Griesemer <gri@golang.org>2021-04-14 19:35:43 +0000
commit892cad7a9b6632533f87bf89d98c43f21c749a80 (patch)
tree31ac7fb609fc7bab64b5c53edfac7dd6578970b9 /src/cmd/compile/internal/types2/subst.go
parent283f9fdbd340a5f3c1b27fd10730986b35e57c89 (diff)
downloadgo-892cad7a9b6632533f87bf89d98c43f21c749a80.tar.gz
go-892cad7a9b6632533f87bf89d98c43f21c749a80.zip
cmd/compile/internal/types2: add Named.SetTParams and Named.Orig methods
Named.SetTParams sets the type parameters for a named type. Named.Orig returns the original generic type an instantiated type is derived from. Added a new field orig for that purpose and renamed the already existing orig field to fromRHS. Finally, updated various comments. Change-Id: Ic9d173e42740422d195713d8bdc62a54dc8c5f54 Reviewed-on: https://go-review.googlesource.com/c/go/+/309832 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/subst.go')
-rw-r--r--src/cmd/compile/internal/types2/subst.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/types2/subst.go b/src/cmd/compile/internal/types2/subst.go
index d730642831..d089317f7d 100644
--- a/src/cmd/compile/internal/types2/subst.go
+++ b/src/cmd/compile/internal/types2/subst.go
@@ -385,8 +385,7 @@ func (subst *subster) typ(typ Type) Type {
// create a new named type and populate caches to avoid endless recursion
tname := NewTypeName(subst.pos, t.obj.pkg, t.obj.name, nil)
- named := subst.check.NewNamed(tname, t.underlying, t.methods) // method signatures are updated lazily
- named.tparams = t.tparams // new type is still parameterized
+ named := subst.check.newNamed(tname, t, t.underlying, t.tparams, t.methods) // method signatures are updated lazily
named.targs = new_targs
subst.check.typMap[h] = named
subst.cache[t] = named
@@ -394,7 +393,7 @@ func (subst *subster) typ(typ Type) Type {
// do the substitution
dump(">>> subst %s with %s (new: %s)", t.underlying, subst.smap, new_targs)
named.underlying = subst.typOrNil(t.underlying)
- named.orig = named.underlying // for cycle detection (Checker.validType)
+ named.fromRHS = named.underlying // for cycle detection (Checker.validType)
return named