-
Notifications
You must be signed in to change notification settings - Fork 556
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
Orizi/dict felt252 for bool and non copy nullable #4340
Orizi/dict felt252 for bool and non copy nullable #4340
Conversation
5fc6685
to
cf7968d
Compare
cf7968d
to
93f7da5
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.
Reviewed 10 of 11 files at r1, all commit messages.
Reviewable status: 10 of 11 files reviewed, 1 unresolved discussion (waiting on @liorgold2, @orizi, and @spapinistarkware)
crates/cairo-lang-sierra/src/extensions/modules/felt252_dict.rs
line 76 at r1 (raw file):
info.zero_sized }) }
Add doc. It's not that clear why the first arg is skipped and why at most 3 args.
Code quote:
id if id == EnumType::id() => {
generic_args.len() <= 3
&& generic_args.into_iter().skip(1).all(|arg| {
let GenericArg::Type(ty) = arg else {
return false;
};
let Ok(info) = context.get_type_info(ty) else {
return false;
};
info.zero_sized
})
}
93f7da5
to
b26017f
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.
Reviewable status: 10 of 11 files reviewed, 1 unresolved discussion (waiting on @gilbens-starkware, @liorgold2, and @spapinistarkware)
crates/cairo-lang-sierra/src/extensions/modules/felt252_dict.rs
line 76 at r1 (raw file):
Previously, gilbens-starkware (Gil Ben-Shachar) wrote…
Add doc. It's not that clear why the first arg is skipped and why at most 3 args.
Done.
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.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @liorgold2 and @spapinistarkware)
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.
Reviewed 9 of 11 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @orizi and @spapinistarkware)
crates/cairo-lang-sierra/src/extensions/modules/felt252_dict.rs
line 67 at r2 (raw file):
id if id == EnumType::id() => { // Enums with 2 or less variant has variant indicator 0 as a valid indicator. // (the additional arg is the user type).
// Zero is not a valid value for enums with 3 or more variants, so they cannot be used in a dict (whose default value is zero).
Code quote:
// Enums with 2 or less variant has variant indicator 0 as a valid indicator.
// (the additional arg is the user 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.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @orizi and @spapinistarkware)
crates/cairo-lang-sierra/src/extensions/modules/felt252_dict.rs
line 69 at r2 (raw file):
// (the additional arg is the user type). generic_args.len() <= 3 // All contained types must be 0 size so the size would only be 1.
.
Suggestion:
// All contained types must be 0-sized, so the total size will be exactly 1.
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.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @orizi and @spapinistarkware)
crates/cairo-lang-sierra/src/extensions/modules/felt252_dict.rs
line 68 at r2 (raw file):
// Enums with 2 or less variant has variant indicator 0 as a valid indicator. // (the additional arg is the user type). generic_args.len() <= 3
Check len >= 1.
b26017f
to
4990c40
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.
Reviewable status: 9 of 11 files reviewed, 4 unresolved discussions (waiting on @gilbens-starkware, @orizi, and @spapinistarkware)
crates/cairo-lang-sierra/src/extensions/modules/felt252_dict.rs
line 42 at r2 (raw file):
} fn specialize_with_dict_value_param(
Document and mention where it used.
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.
Reviewable status: 9 of 11 files reviewed, 3 unresolved discussions (waiting on @gilbens-starkware, @liorgold2, and @spapinistarkware)
crates/cairo-lang-sierra/src/extensions/modules/felt252_dict.rs
line 67 at r2 (raw file):
Previously, liorgold2 wrote…
// Zero is not a valid value for enums with 3 or more variants, so they cannot be used in a dict (whose default value is zero).
Done.
crates/cairo-lang-sierra/src/extensions/modules/felt252_dict.rs
line 68 at r2 (raw file):
Previously, liorgold2 wrote…
Check len >= 1.
Done.
crates/cairo-lang-sierra/src/extensions/modules/felt252_dict.rs
line 69 at r2 (raw file):
Previously, liorgold2 wrote…
.
Done.
4990c40
to
b2d9f3c
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.
Reviewable status: 9 of 11 files reviewed, 4 unresolved discussions (waiting on @gilbens-starkware, @liorgold2, and @spapinistarkware)
crates/cairo-lang-sierra/src/extensions/modules/felt252_dict.rs
line 42 at r2 (raw file):
Previously, liorgold2 wrote…
Document and mention where it used.
Done.
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.
Reviewed 1 of 1 files at r2, 1 of 2 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @spapinistarkware)
* Enums of size 2 or smaller (to include bool). * Nullable of `Drop` types, to allow `Nullable<Array<felt252>>`. * Minor refactoring to allow this, and to merge dict and entry code.
b2d9f3c
to
2941502
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.
Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @spapinistarkware)
This change is