Skip to content
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

Treat Union{Bool, Real} as StructTypes.Struct #174

Merged
merged 1 commit into from
Aug 3, 2021
Merged

Treat Union{Bool, Real} as StructTypes.Struct #174

merged 1 commit into from
Aug 3, 2021

Conversation

quinnj
Copy link
Owner

@quinnj quinnj commented Aug 3, 2021

By default, Union{Bool, Real} has struct type StructTypes.NumberType
since Bool <: Integer, but when parsing a Bool or a Real from
json, we want to treat them distinctly, by parsing a Bool or a
Real. The solution here is to just intercept the read call for those
Union types and pass it to the Struct method.

By default, `Union{Bool, Real}` has struct type `StructTypes.NumberType`
since `Bool <: Integer`, but when parsing a `Bool` or a `Real` from
json, we want to treat them distinctly, by parsing a `Bool` _or_ a
`Real`. The solution here is to just intercept the `read` call for those
`Union` types and pass it to the `Struct` method.
@quinnj quinnj mentioned this pull request Aug 3, 2021
@codecov
Copy link

codecov bot commented Aug 3, 2021

Codecov Report

Merging #174 (031735b) into main (807bc9b) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #174   +/-   ##
=======================================
  Coverage   88.94%   88.95%           
=======================================
  Files           9        9           
  Lines        1574     1575    +1     
=======================================
+ Hits         1400     1401    +1     
  Misses        174      174           
Impacted Files Coverage Δ
src/structs.jl 90.01% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 807bc9b...031735b. Read the comment docs.

@quinnj quinnj merged commit 28a3a8b into main Aug 3, 2021
@quinnj quinnj deleted the jq/boolunion branch August 3, 2021 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant