-
Notifications
You must be signed in to change notification settings - Fork 3
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
fix(patterns): fix composing AnyOf
and AllOf
patterns
#7
Conversation
cpcloud
commented
Aug 6, 2024
•
edited
Loading
edited
- test: add test for and-ing and or-ing allof/anyof
- fix(patterns): reference the correct attribute in sugar
50f57f0
to
1f32dfa
Compare
Seems like |
Right, you need to cast the object to the extension type first: return AnyOf(*self.inners, *other.inners) to left: AnyOf = cython.cast(AnyOf, self)
right: AnyOf = cython.cast(AnyOf, other)
return AnyOf(*left.inners, *right.inners) |
Ah, roger that. Fixing it now. |
elif isinstance(self, AllOf): | ||
return AllOf(*self.patterns, other) | ||
elif isinstance(other, AllOf): | ||
return AllOf(self, *other.patterns) |
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.
I dunno, maybe the original but with casts is better, the entire implementation is in a single place 🤔
d017ee3
to
f6a2074
Compare
AnyOf
and AllOf
patterns
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.
Sweet, thanks Phillip!