Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A number of edge-cases #48

@puellanivis

Description

@puellanivis

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions