Source file src/cmd/vendor/golang.org/x/tools/internal/aliases/aliases_go121.go

     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  //go:build !go1.22
     6  // +build !go1.22
     7  
     8  package aliases
     9  
    10  import (
    11  	"go/types"
    12  )
    13  
    14  // Alias is a placeholder for a go/types.Alias for <=1.21.
    15  // It will never be created by go/types.
    16  type Alias struct{}
    17  
    18  func (*Alias) String() string                                { panic("unreachable") }
    19  func (*Alias) Underlying() types.Type                        { panic("unreachable") }
    20  func (*Alias) Obj() *types.TypeName                          { panic("unreachable") }
    21  func Rhs(alias *Alias) types.Type                            { panic("unreachable") }
    22  func TypeParams(alias *Alias) *types.TypeParamList           { panic("unreachable") }
    23  func SetTypeParams(alias *Alias, tparams []*types.TypeParam) { panic("unreachable") }
    24  func TypeArgs(alias *Alias) *types.TypeList                  { panic("unreachable") }
    25  func Origin(alias *Alias) *Alias                             { panic("unreachable") }
    26  
    27  // Unalias returns the type t for go <=1.21.
    28  func Unalias(t types.Type) types.Type { return t }
    29  
    30  func newAlias(name *types.TypeName, rhs types.Type, tparams []*types.TypeParam) *Alias {
    31  	panic("unreachable")
    32  }
    33  
    34  // Enabled reports whether [NewAlias] should create [types.Alias] types.
    35  //
    36  // Before go1.22, this function always returns false.
    37  func Enabled() bool { return false }
    38  

View as plain text