-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
A null dynamic value is a known value when comparing equality #55
Conversation
When checking for nested dynamic types within complex types for equality comparison, we need to also verify that those dynamic types are not already known to be null. Add the Value.HasDynamicValues method, to check for nested DynamicVal values. HasDynamicValues indicates not only that this value is unknown, but the type may change as well. This is used in the Value.Equals method before checking the type for equality.
Even when a value contains dynamic values, we may still be able to determine inequality when there is no way the types could conform.
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.
FWIW this change makes perfect sense to me.
We weren't checking for unknown types within an unknown container.
HasDynamicTypes was not checking element collection types
This better describes the intent, and is a little more constant with the other Value method names.
Codecov Report
@@ Coverage Diff @@
## master #55 +/- ##
==========================================
+ Coverage 70.54% 70.73% +0.19%
==========================================
Files 79 79
Lines 7153 7176 +23
==========================================
+ Hits 5046 5076 +30
+ Misses 1664 1659 -5
+ Partials 443 441 -2
Continue to review full report at Codecov.
|
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.
This makes sense to me, though (as noted inline) I think the implementation is returning the opposite of what the new name suggests. Aside from that, this looks good to me!
// DynamicVal. This implies that both the value is not known, and the final | ||
// type may change. | ||
func (val Value) HasDynamicValues() bool { | ||
func (val Value) HasWhollyKnownType() bool { |
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.
It looks like you inverted the direction of the name here but not the implementation along with it... if I'm reading correctly, the logic below seems to produce an answer to "Doesn't have a wholly known type".
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.
😆 oh yes, I just did a find and replace 😞 Will fix ASAP
The name was updated, but the actual logic was not inverted to match the new name.
When checking for nested dynamic types within complex types for equality comparison, we need to also verify that those dynamic types are not already known to be null.
Add the
Value.HasWhollyKnownType
method, to check for nestedDynamicVal
values.HasWhollyKnownType
indicates not only that this value is not wholly known, but the type may change as well; as opposed toHasDynamicTypes
, which only indicates thatDynamicPseudoType
exists within the type. This is used in theValue.Equals
method before checking the type for equality.Even when a value contains
DynamicVal
, we may still be able to check for inequality if the types are not conformant. CheckTestConformance
in both directions to see if there is any possibility of the types later becoming equal.This also fixes a bug in
Type.HasDynamicTypes
, which was failing to descent into container element types.