Skip to content

Fix isNullish to properly handle typed nil #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 17 commits into from
Closed

Fix isNullish to properly handle typed nil #107

wants to merge 17 commits into from

Conversation

samuel
Copy link
Contributor

@samuel samuel commented Jan 22, 2016

The test demonstrates what the problem was. For typed nil values (e.g. fields of a struct that are pointers to other structs), isNullish wasn't properly detecting the nil value.

Also removed the NaN check for int since there's no case where it can be true as far as I know.

@samuel samuel changed the title Fix isNullish to properly handle nil behind the interface. Fix isNullish to properly handle typed nil Jan 22, 2016
@chris-ramon chris-ramon added this to the alpha-0.1 milestone Jan 22, 2016
samuel added 16 commits February 9, 2016 14:21
benchmark             old ns/op     new ns/op     delta
BenchmarkParser-4     6310982       1455274       -76.94%

benchmark             old allocs     new allocs     delta
BenchmarkParser-4     1340           412            -69.25%

benchmark             old bytes     new bytes     delta
BenchmarkParser-4     2848964       16522         -99.42%
benchmark             old ns/op     new ns/op     delta
BenchmarkParser-4     1455274       47895         -96.71%

benchmark             old allocs     new allocs     delta
BenchmarkParser-4     412            424            +2.91%

benchmark             old bytes     new bytes     delta
BenchmarkParser-4     16522         16952         +2.60%
benchmark                       old ns/op     new ns/op     delta
BenchmarkDefaultResolveFn-4     4727          172           -96.36%

benchmark                       old allocs     new allocs     delta
BenchmarkDefaultResolveFn-4     19             1              -94.74%

benchmark                       old bytes     new bytes     delta
BenchmarkDefaultResolveFn-4     2021          16            -99.21%
benchmark            old ns/op     new ns/op     delta
BenchmarkPrint-4     5676362       32231         -99.43%

benchmark            old allocs     new allocs     delta
BenchmarkPrint-4     25868          210            -99.19%

benchmark            old bytes     new bytes     delta
BenchmarkPrint-4     1146858       11744         -98.98%
benchmark                       old ns/op     new ns/op     delta
BenchmarkValidateDocument-4     3689089       1757236       -52.37%

benchmark                       old allocs     new allocs     delta
BenchmarkValidateDocument-4     14282          5721           -59.94%

benchmark                       old bytes     new bytes     delta
BenchmarkValidateDocument-4     536062        257161        -52.03%
benchmark                       old ns/op     new ns/op     delta
BenchmarkValidateDocument-4     1757236       1727862       -1.67%

benchmark                       old allocs     new allocs     delta
BenchmarkValidateDocument-4     5721           5639           -1.43%

benchmark                       old bytes     new bytes     delta
BenchmarkValidateDocument-4     257161        247368        -3.81%
benchmark                       old ns/op     new ns/op     delta
BenchmarkValidateDocument-4     1727862       505599        -70.74%

benchmark                       old allocs     new allocs     delta
BenchmarkValidateDocument-4     5639           1450           -74.29%

benchmark                       old bytes     new bytes     delta
BenchmarkValidateDocument-4     247368        110322        -55.40%
benchmark                       old ns/op     new ns/op     delta
BenchmarkValidateDocument-4     515388        160199        -68.92%

benchmark                       old allocs     new allocs     delta
BenchmarkValidateDocument-4     1450           645            -55.52%

benchmark                       old bytes     new bytes     delta
BenchmarkValidateDocument-4     110322        101546        -7.95%
benchmark                       old ns/op     new ns/op     delta
BenchmarkValidateDocument-4     160199        102851        -35.80%

benchmark                       old allocs     new allocs     delta
BenchmarkValidateDocument-4     645            139            -78.45%

benchmark                       old bytes     new bytes     delta
BenchmarkValidateDocument-4     101546        26920         -73.49%
@coveralls
Copy link

Coverage Status

Coverage decreased (-86.9%) to 8.904% when pulling ded2783 on SpruceHealth:master into 26c58bd on graphql-go:master.

@samuel samuel closed this May 25, 2016
@samuel
Copy link
Contributor Author

samuel commented May 25, 2016

Sorry for the noise, forgot this PR was open and when I merged to our fork's master it updated it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants