mirror of
https://github.com/golang/go
synced 2024-11-19 00:04:40 -07:00
go/tools/ssa/interp: make iface.eq robust against nil types
A future version of go/types.IsIdentical does not accept nil types anymore. R=adonovan CC=golang-dev https://golang.org/cl/16150043
This commit is contained in:
parent
36c288d6d7
commit
a1886cc6ef
@ -169,9 +169,17 @@ func (x structure) hash(t types.Type) int {
|
||||
return h
|
||||
}
|
||||
|
||||
// nil-tolerant variant of types.IsIdentical.
|
||||
func sameType(x, y types.Type) bool {
|
||||
if x == nil {
|
||||
return y == nil
|
||||
}
|
||||
return y != nil && types.IsIdentical(x, y)
|
||||
}
|
||||
|
||||
func (x iface) eq(t types.Type, _y interface{}) bool {
|
||||
y := _y.(iface)
|
||||
return types.IsIdentical(x.t, y.t) && (x.t == nil || equals(x.t, x.v, y.v))
|
||||
return sameType(x.t, y.t) && (x.t == nil || equals(x.t, x.v, y.v))
|
||||
}
|
||||
|
||||
func (x iface) hash(_ types.Type) int {
|
||||
|
Loading…
Reference in New Issue
Block a user