aboutsummaryrefslogtreecommitdiff
path: root/src/go/types/named.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/go/types/named.go')
-rw-r--r--src/go/types/named.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/go/types/named.go b/src/go/types/named.go
index fd9e1f4461..943d52f0fe 100644
--- a/src/go/types/named.go
+++ b/src/go/types/named.go
@@ -17,7 +17,6 @@ type Named struct {
orig *Named // original, uninstantiated type
fromRHS Type // type (on RHS of declaration) this *Named type is derived of (for cycle reporting)
underlying Type // possibly a *Named during setup; never a *Named once set up completely
- instPos *token.Pos // position information for lazy instantiation, or nil
tparams *TypeParamList // type parameters, or nil
targs *TypeList // type arguments (after instantiation), or nil
methods []*Func // methods declared for this type (not the method set of this type); signatures are type-checked lazily
@@ -222,11 +221,11 @@ func (n *Named) setUnderlying(typ Type) {
// expandNamed ensures that the underlying type of n is instantiated.
// The underlying type will be Typ[Invalid] if there was an error.
-func expandNamed(env *Environment, n *Named) (*TypeParamList, Type, []*Func) {
+func expandNamed(env *Environment, n *Named, instPos token.Pos) (*TypeParamList, Type, []*Func) {
n.orig.resolve(env)
var u Type
- if n.check.validateTArgLen(*n.instPos, n.orig.tparams.Len(), n.targs.Len()) {
+ if n.check.validateTArgLen(instPos, n.orig.tparams.Len(), n.targs.Len()) {
// TODO(rfindley): handling an optional Checker and Environment here (and
// in subst) feels overly complicated. Can we simplify?
if env == nil {
@@ -245,11 +244,10 @@ func expandNamed(env *Environment, n *Named) (*TypeParamList, Type, []*Func) {
// shouldn't return that instance from expand.
env.typeForHash(h, n)
}
- u = n.check.subst(*n.instPos, n.orig.underlying, makeSubstMap(n.orig.tparams.list(), n.targs.list()), env)
+ u = n.check.subst(instPos, n.orig.underlying, makeSubstMap(n.orig.tparams.list(), n.targs.list()), env)
} else {
u = Typ[Invalid]
}
- n.instPos = nil
return n.orig.tparams, u, n.orig.methods
}