type Context … type ctxtEntry … // NewContext creates a new Context. func NewContext() *Context { … } // instanceHash returns a string representation of typ instantiated with targs. // The hash should be a perfect hash, though out of caution the type checker // does not assume this. The result is guaranteed to not contain blanks. func (ctxt *Context) instanceHash(orig Type, targs []Type) string { … } // lookup returns an existing instantiation of orig with targs, if it exists. // Otherwise, it returns nil. func (ctxt *Context) lookup(h string, orig Type, targs []Type) Type { … } // update de-duplicates inst against previously seen types with the hash h. // If an identical type is found with the type hash h, the previously seen // type is returned. Otherwise, inst is returned, and recorded in the Context // for the hash h. func (ctxt *Context) update(h string, orig Type, targs []Type, inst Type) Type { … } // getID returns a unique ID for the type t. func (ctxt *Context) getID(t Type) int { … }