deep icon indicating copy to clipboard operation
deep copied to clipboard

A number of edge-cases

Open puellanivis opened this issue 3 years ago • 1 comments

I’m documenting a few edge-case bugs that came up while I was tinkering with the package. I have a branch with fixes for most of the currently open issues as well as the ones below. I just want to have them written down some where just in case I don’t get the PR open, and my code falls into the void.

The weirds:

  • the code will panic if a type implements the wrong return value for Equal. Say func (Type) Equal(Type) int.
  • the code will erroneously report zero and negative zero as inequal, but these values == as true.
  • the code is treating value.IsValid() as a definitive dereferenced nil-pointer, but this is not guaranteed. (Fixing this requires checking for the nil-pointers before derefing with .Elem(). When fixed, this lets us be a little more specific between <invalid value> and <nil pointer>)
  • deep.Equal(nil, bType) is not strictly comparing a <nil pointer> to a bType, but rather an “untyped nil”, which compares as inequal to a typed nil-pointer. (The bane of everyone who wonders how their return nil function could possible not compare equal to nil in the caller)

puellanivis avatar Aug 18 '21 20:08 puellanivis