-
Notifications
You must be signed in to change notification settings - Fork 66
Support atoms with multiple types #73
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
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jennybuckley The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
errs = append(errs, w.derefMapOrStruct("lhs: ", "map", w.lhs, &lhs)...) | ||
errs = append(errs, w.derefMapOrStruct("rhs: ", "map", w.rhs, &rhs)...) | ||
w.derefMapOrStruct("lhs: ", "map", w.lhs, &lhs) | ||
w.derefMapOrStruct("rhs: ", "map", w.rhs, &rhs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could actually remove these errors from all the cases (because the type errors are caught earlier now), but I wanted to keep the diff smaller
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't think that they should ever happen, can we panic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the error case can happen, but what we want it to do in that case is treat the value as nil
ccb0e03
to
1176386
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is not much to say, this very cool again
typed/merge.go
Outdated
alhs := deduceAtom(a, w.lhs) | ||
arhs := deduceAtom(a, w.rhs) | ||
if reflect.DeepEqual(alhs, arhs) { | ||
errs =append(errs, handleAtom(arhs, w.typeRef, w)...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very important: missing space :-)
Do you want to squash and I lgtm or do you want to move the type to schemaconv? |
I think we agree that it was better before that last commit? |
/lgtm |
We need to add a little bit more testing for this feature, let's follow-up after. |
Get rid of schema.DeduceType and instead allow atoms with multiple types defined and use the type of data to eliminate incompatible types.
Also changes Untyped Deduced to this:
This is necessary if we want to support things like JSONPropsOrArray in the future