mirror of
https://github.com/golang/go
synced 2024-11-23 19:00:04 -07:00
go/types: move Identical* predicates into api.go file (cleanup)
Follow-up CL removing a TODO. Change-Id: If900d2f999f6a3e2f2ead29283375547e03cac86 Reviewed-on: https://go-review.googlesource.com/c/go/+/196337 Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
1ee9bc9b0f
commit
110bbc4966
@ -374,3 +374,15 @@ func Implements(V Type, T *Interface) bool {
|
|||||||
f, _ := MissingMethod(V, T, true)
|
f, _ := MissingMethod(V, T, true)
|
||||||
return f == nil
|
return f == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Identical reports whether x and y are identical types.
|
||||||
|
// Receivers of Signature types are ignored.
|
||||||
|
func Identical(x, y Type) bool {
|
||||||
|
return (*Checker)(nil).identical(x, y)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 {
|
||||||
|
return (*Checker)(nil).identicalIgnoreTags(x, y)
|
||||||
|
}
|
||||||
|
@ -110,29 +110,14 @@ func hasNil(typ Type) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// The functions Identical and IdenticalIgnoreTags are
|
// identical reports whether x and y are identical types.
|
||||||
// provided for external use only, after interface types
|
|
||||||
// were fully set up (completed). During type-checking,
|
|
||||||
// use the methods identical and identicalIgnoreTags
|
|
||||||
// which take a non-nil *Checker receiver.
|
|
||||||
// TODO(gri) factor these out into api.go.
|
|
||||||
|
|
||||||
// Identical reports whether x and y are identical types.
|
|
||||||
// Receivers of Signature types are ignored.
|
// Receivers of Signature types are ignored.
|
||||||
func Identical(x, y Type) bool {
|
|
||||||
return (*Checker)(nil).identical(x, y)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (check *Checker) identical(x, y Type) bool {
|
func (check *Checker) identical(x, y Type) bool {
|
||||||
return check.identical0(x, y, true, nil)
|
return check.identical0(x, y, true, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IdenticalIgnoreTags reports whether x and y are identical types if tags are ignored.
|
// identicalIgnoreTags reports whether x and y are identical types if tags are ignored.
|
||||||
// Receivers of Signature types are ignored.
|
// Receivers of Signature types are ignored.
|
||||||
func IdenticalIgnoreTags(x, y Type) bool {
|
|
||||||
return (*Checker)(nil).identicalIgnoreTags(x, y)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (check *Checker) identicalIgnoreTags(x, y Type) bool {
|
func (check *Checker) identicalIgnoreTags(x, y Type) bool {
|
||||||
return check.identical0(x, y, false, nil)
|
return check.identical0(x, y, false, nil)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user