mirror of
https://github.com/golang/go.git
synced 2025-05-29 03:11:26 +00:00
go/types: document that Signature.Recv() is ignored for type identity
Fixes #21367. Change-Id: I50704c5a613abcce57b340db8992c7bcb1cb728f Reviewed-on: https://go-review.googlesource.com/55710 Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
53836a74f8
commit
f6f125dd07
@ -110,12 +110,14 @@ func hasNil(typ Type) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Identical reports whether x and y are identical.
|
// Identical reports whether x and y are identical types.
|
||||||
|
// Receivers of Signature types are ignored.
|
||||||
func Identical(x, y Type) bool {
|
func Identical(x, y Type) bool {
|
||||||
return identical(x, y, true, nil)
|
return identical(x, y, true, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IdenticalIgnoreTags reports whether x and y are identical if tags are ignored.
|
// IdenticalIgnoreTags reports whether x and y are identical types if tags are ignored.
|
||||||
|
// Receivers of Signature types are ignored.
|
||||||
func IdenticalIgnoreTags(x, y Type) bool {
|
func IdenticalIgnoreTags(x, y Type) bool {
|
||||||
return identical(x, y, false, nil)
|
return identical(x, y, false, nil)
|
||||||
}
|
}
|
||||||
|
@ -191,6 +191,7 @@ func (t *Tuple) Len() int {
|
|||||||
func (t *Tuple) At(i int) *Var { return t.vars[i] }
|
func (t *Tuple) At(i int) *Var { return t.vars[i] }
|
||||||
|
|
||||||
// A Signature represents a (non-builtin) function or method type.
|
// A Signature represents a (non-builtin) function or method type.
|
||||||
|
// The receiver is ignored when comparing signatures for identity.
|
||||||
type Signature struct {
|
type Signature struct {
|
||||||
// We need to keep the scope in Signature (rather than passing it around
|
// We need to keep the scope in Signature (rather than passing it around
|
||||||
// and store it in the Func Object) because when type-checking a function
|
// and store it in the Func Object) because when type-checking a function
|
||||||
@ -221,7 +222,7 @@ func NewSignature(recv *Var, params, results *Tuple, variadic bool) *Signature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Recv returns the receiver of signature s (if a method), or nil if a
|
// Recv returns the receiver of signature s (if a method), or nil if a
|
||||||
// function.
|
// function. It is ignored when comparing signatures for identity.
|
||||||
//
|
//
|
||||||
// For an abstract method, Recv returns the enclosing interface either
|
// For an abstract method, Recv returns the enclosing interface either
|
||||||
// as a *Named or an *Interface. Due to embedding, an interface may
|
// as a *Named or an *Interface. Due to embedding, an interface may
|
||||||
|
Loading…
x
Reference in New Issue
Block a user