blob: 63391e584b6493b37014a91d291017ace7940553 [file] [log] [blame]
Tim King0be034b2024-01-31 14:34:13 -08001// 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
8package aliases
9
10import (
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.
16type Alias struct{}
17
Alan Donovan8b51d662024-07-25 17:24:39 -070018func (*Alias) String() string { panic("unreachable") }
19func (*Alias) Underlying() types.Type { panic("unreachable") }
20func (*Alias) Obj() *types.TypeName { panic("unreachable") }
21func Rhs(alias *Alias) types.Type { panic("unreachable") }
22func TypeParams(alias *Alias) *types.TypeParamList { panic("unreachable") }
Tim King0be034b2024-01-31 14:34:13 -080023
24// Unalias returns the type t for go <=1.21.
25func Unalias(t types.Type) types.Type { return t }
26
Tim King0be034b2024-01-31 14:34:13 -080027func newAlias(name *types.TypeName, rhs types.Type) *Alias { panic("unreachable") }
Alan Donovan440f3c32024-04-19 14:21:28 -040028
29// Enabled reports whether [NewAlias] should create [types.Alias] types.
30//
31// Before go1.22, this function always returns false.
32func Enabled() bool { return false }