-
Notifications
You must be signed in to change notification settings - Fork 103
datetime
extension
#1276
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
datetime
extension
#1276
Conversation
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
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.
Maybe I've missed them while reviewing, but I'd like to see at least one end-to-end test for the extension.
{ | ||
fn into_restricted_expr(&self) -> RestrictedExpr { | ||
self.clone().into() | ||
} |
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.
Why not just implement Into
?
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 believe it's because of the trait object stuff I don't understand. See the comment above this trait.
let long_op = if matches!(op, BinaryOp::Less) { | ||
|x, y| x < y | ||
} else { | ||
|x, y| x <= y |
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'd probably start this arm with the match (arg1.value_kind(), arg2.value_kind())
and then compute long_op
or ext_op
on-demand. But I'm actually not clear on why we're using different variables at the moment neither... I would really like to see some comments here.
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 believe it's due to the type checker not being happy if I simply use one variable.
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
This reverts commit 3f2e39b.
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
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 did not review the validator changes, would be good to get @john-h-kastner-aws review on those.
/// Get the constructor and args that can reproduce this value | ||
pub fn constructor_and_args(&self) -> (&Name, &[RestrictedExpr]) { | ||
(&self.constructor, &self.args) | ||
pub(crate) fn supports_operator_overloading(&self) -> 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.
At the risk of adding yet another new-type wrapper around our identifier types, it looks like it might make more sense to have this be a function on an ExtensionType
struct instead of the ExtensionValue
struct.
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Co-authored-by: Craig Disselkoen <cdiss@amazon.com> Co-authored-by: Adrian Palacios <73246657+adpaco-aws@users.noreply.github.com> Co-authored-by: Andrew Wells <130512013+andrewmwells-amazon@users.noreply.github.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
…ar into feature/shaobo/datetime
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Description of changes
Implement RFC 80
Issue #, if available
Checklist for requesting a review
The change in this PR is (choose one, and delete the other options):
cedar-policy
(e.g., addition of a new API).I confirm that this PR (choose one, and delete the other options):
I confirm that
cedar-spec
(choose one, and delete the other options):cedar-spec
, and how you have tested that your updates are correct.)I confirm that
docs.cedarpolicy.com
(choose one, and delete the other options):cedar-docs
. PRs should be targeted at astaging-X.Y
branch, notmain
.)