Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for makeSubstMap (0.24 sec)

  1. src/cmd/compile/internal/types2/subst.go

    package types2
    
    import (
    	"cmd/compile/internal/syntax"
    )
    
    type substMap map[*TypeParam]Type
    
    // makeSubstMap creates a new substitution map mapping tpars[i] to targs[i].
    // If targs[i] is nil, tpars[i] is not substituted.
    func makeSubstMap(tpars []*TypeParam, targs []Type) substMap {
    	assert(len(tpars) == len(targs))
    	proj := make(substMap, len(tpars))
    	for i, tpar := range tpars {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:04:07 UTC 2024
    - 11K bytes
    - Viewed (0)
  2. src/go/types/subst.go

    // This file implements type parameter substitution.
    
    package types
    
    import (
    	"go/token"
    )
    
    type substMap map[*TypeParam]Type
    
    // makeSubstMap creates a new substitution map mapping tpars[i] to targs[i].
    // If targs[i] is nil, tpars[i] is not substituted.
    func makeSubstMap(tpars []*TypeParam, targs []Type) substMap {
    	assert(len(tpars) == len(targs))
    	proj := make(substMap, len(tpars))
    	for i, tpar := range tpars {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:04:07 UTC 2024
    - 11.1K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/types2/alias.go

    func (check *Checker) newAliasInstance(pos syntax.Pos, orig *Alias, targs []Type, ctxt *Context) *Alias {
    	assert(len(targs) > 0)
    	obj := NewTypeName(pos, orig.obj.pkg, orig.obj.name, nil)
    	rhs := check.subst(pos, orig.fromRHS, makeSubstMap(orig.TypeParams().list(), targs), nil, ctxt)
    	res := check.newAlias(obj, rhs)
    	res.orig = orig
    	res.tparams = orig.tparams
    	res.targs = newTypeList(targs)
    	return res
    }
    
    func (a *Alias) cleanup() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 5K bytes
    - Viewed (0)
  4. src/go/types/alias.go

    func (check *Checker) newAliasInstance(pos token.Pos, orig *Alias, targs []Type, ctxt *Context) *Alias {
    	assert(len(targs) > 0)
    	obj := NewTypeName(pos, orig.obj.pkg, orig.obj.name, nil)
    	rhs := check.subst(pos, orig.fromRHS, makeSubstMap(orig.TypeParams().list(), targs), nil, ctxt)
    	res := check.newAlias(obj, rhs)
    	res.orig = orig
    	res.tparams = orig.tparams
    	res.targs = newTypeList(targs)
    	return res
    }
    
    func (a *Alias) cleanup() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 5.1K bytes
    - Viewed (0)
  5. src/go/types/instantiate.go

    			return Typ[Invalid]
    		}
    		if tparams.Len() == 0 {
    			return orig // nothing to do (minor optimization)
    		}
    		sig := check.subst(pos, orig, makeSubstMap(tparams.list(), targs), nil, ctxt).(*Signature)
    		// If the signature doesn't use its type parameters, subst
    		// will not make a copy. In that case, make a copy now (so
    		// we can set tparams to nil w/o causing side-effects).
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 12.8K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/types2/infer.go

    	//           (which only happens in case of an error) and then avoid doing
    	//           the substitution (which always happens).
    	if params.Len() > 0 {
    		smap := makeSubstMap(tparams, targs)
    		params = check.subst(nopos, params, smap, nil, check.context()).(*Tuple)
    	}
    
    	// Unify parameter and argument types for generic parameters with typed arguments
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 13:54:20 UTC 2024
    - 26.4K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/types2/instantiate.go

    			return Typ[Invalid]
    		}
    		if tparams.Len() == 0 {
    			return orig // nothing to do (minor optimization)
    		}
    		sig := check.subst(pos, orig, makeSubstMap(tparams.list(), targs), nil, ctxt).(*Signature)
    		// If the signature doesn't use its type parameters, subst
    		// will not make a copy. In that case, make a copy now (so
    		// we can set tparams to nil w/o causing side-effects).
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 12.7K bytes
    - Viewed (0)
  8. src/go/types/infer.go

    	//           (which only happens in case of an error) and then avoid doing
    	//           the substitution (which always happens).
    	if params.Len() > 0 {
    		smap := makeSubstMap(tparams, targs)
    		params = check.subst(nopos, params, smap, nil, check.context()).(*Tuple)
    	}
    
    	// Unify parameter and argument types for generic parameters with typed arguments
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 13:54:20 UTC 2024
    - 26.5K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/types2/named.go

    	// and type parameters. This check is necessary in the presence of invalid
    	// code.
    	if origSig.RecvTypeParams().Len() == t.inst.targs.Len() {
    		smap := makeSubstMap(origSig.RecvTypeParams().list(), t.inst.targs.list())
    		var ctxt *Context
    		if check != nil {
    			ctxt = check.context()
    		}
    		sig = check.subst(origm.pos, origSig, smap, t, ctxt).(*Signature)
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 20:03:31 UTC 2024
    - 23.9K bytes
    - Viewed (0)
  10. src/go/types/named.go

    	// and type parameters. This check is necessary in the presence of invalid
    	// code.
    	if origSig.RecvTypeParams().Len() == t.inst.targs.Len() {
    		smap := makeSubstMap(origSig.RecvTypeParams().list(), t.inst.targs.list())
    		var ctxt *Context
    		if check != nil {
    			ctxt = check.context()
    		}
    		sig = check.subst(origm.pos, origSig, smap, t, ctxt).(*Signature)
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 20:03:31 UTC 2024
    - 24K bytes
    - Viewed (0)
Back to top