1 // Copyright 2024 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4 5 package aliases
6 7 import (
8 "go/token"
9 "go/types"
10 )
11 12 // New creates a new TypeName in Package pkg that
13 // is an alias for the type rhs.
14 func New(pos token.Pos, pkg *types.Package, name string, rhs types.Type, tparams []*types.TypeParam) *types.TypeName {
15 tname := types.NewTypeName(pos, pkg, name, nil)
16 types.NewAlias(tname, rhs).SetTypeParams(tparams)
17 return tname
18 }
19