We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 664cf83 commit db8f1dcCopy full SHA for db8f1dc
src/hash/maphash/maphash_purego.go
@@ -161,7 +161,7 @@ func appendT(h *Hash, v reflect.Value) {
161
case reflect.Bool:
162
h.WriteByte(btoi(v.Bool()))
163
return
164
- case reflect.UnsafePointer, reflect.Pointer:
+ case reflect.UnsafePointer, reflect.Pointer, reflect.Chan:
165
var buf [8]byte
166
// because pointing to the abi.Escape call in comparableReady,
167
// So this is ok to hash pointer,
src/hash/maphash/maphash_test.go
@@ -253,12 +253,17 @@ func TestComparable(t *testing.T) {
253
}
254
testComparable(t, s1, s2)
255
testComparable(t, s1.s, s2.s)
256
+ c1 := make(chan struct{})
257
+ c2 := make(chan struct{})
258
+ testComparable(t, c1, c1)
259
+ testComparable(t, chan struct{}(nil))
260
testComparable(t, float32(0), negativeZero[float32]())
261
testComparable(t, float64(0), negativeZero[float64]())
262
testComparableNoEqual(t, math.NaN(), math.NaN())
263
testComparableNoEqual(t, [2]string{"a", ""}, [2]string{"", "a"})
264
testComparableNoEqual(t, struct{ a, b string }{"foo", ""}, struct{ a, b string }{"", "foo"})
265
testComparableNoEqual(t, struct{ a, b any }{int(0), struct{}{}}, struct{ a, b any }{struct{}{}, int(0)})
266
+ testComparableNoEqual(t, c1, c2)
267
268
269
func testComparableNoEqual[T comparable](t *testing.T, v1, v2 T) {
0 commit comments