@@ -6,8 +6,6 @@ package ssa
6
6
7
7
import (
8
8
"go/types"
9
-
10
- "golang.org/x/tools/internal/typeparams"
11
9
)
12
10
13
11
// Type substituter for a fixed set of replacement types.
@@ -233,12 +231,12 @@ func (subst *subster) union(u *types.Union) *types.Union {
233
231
}
234
232
}
235
233
if out != nil {
236
- out [i ] = typeparams .NewTerm (t .Tilde (), r )
234
+ out [i ] = types .NewTerm (t .Tilde (), r )
237
235
}
238
236
}
239
237
240
238
if out != nil {
241
- return typeparams .NewUnion (out )
239
+ return types .NewUnion (out )
242
240
}
243
241
return u
244
242
}
@@ -310,7 +308,7 @@ func (subst *subster) named(t *types.Named) types.Type {
310
308
// (2) locally scoped type,
311
309
// (3) generic (type parameters but no type arguments), or
312
310
// (4) instantiated (type parameters and type arguments).
313
- tparams := typeparams . ForNamed ( t )
311
+ tparams := t . TypeParams ( )
314
312
if tparams .Len () == 0 {
315
313
if subst .scope != nil && ! subst .scope .Contains (t .Obj ().Pos ()) {
316
314
// Outside the current function scope?
@@ -344,7 +342,7 @@ func (subst *subster) named(t *types.Named) types.Type {
344
342
n .SetUnderlying (subst .typ (t .Underlying ()))
345
343
return n
346
344
}
347
- targs := typeparams . NamedTypeArgs ( t )
345
+ targs := t . TypeArgs ( )
348
346
349
347
// insts are arguments to instantiate using.
350
348
insts := make ([]types.Type , tparams .Len ())
@@ -367,13 +365,13 @@ func (subst *subster) named(t *types.Named) types.Type {
367
365
inst := subst .typ (targs .At (i )) // TODO(generic): Check with rfindley for mutual recursion
368
366
insts [i ] = inst
369
367
}
370
- r , err := typeparams .Instantiate (subst .ctxt , typeparams . NamedTypeOrigin ( t ), insts , false )
368
+ r , err := types .Instantiate (subst .ctxt , t . Origin ( ), insts , false )
371
369
assert (err == nil , "failed to Instantiate Named type" )
372
370
return r
373
371
}
374
372
375
373
func (subst * subster ) signature (t * types.Signature ) types.Type {
376
- tparams := typeparams . ForSignature ( t )
374
+ tparams := t . TypeParams ( )
377
375
378
376
// We are choosing not to support tparams.Len() > 0 until a need has been observed in practice.
379
377
//
@@ -398,7 +396,7 @@ func (subst *subster) signature(t *types.Signature) types.Type {
398
396
params := subst .tuple (t .Params ())
399
397
results := subst .tuple (t .Results ())
400
398
if recv != t .Recv () || params != t .Params () || results != t .Results () {
401
- return typeparams .NewSignatureType (recv , nil , nil , params , results , t .Variadic ())
399
+ return types .NewSignatureType (recv , nil , nil , params , results , t .Variadic ())
402
400
}
403
401
return t
404
402
}
0 commit comments