-
Notifications
You must be signed in to change notification settings - Fork 492
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
added Fn trait #6659
base: main
Are you sure you want to change the base?
added Fn trait #6659
Conversation
50a74a1
to
42020d5
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 15 of 16 files at r1.
Reviewable status: 14 of 16 files reviewed, 3 unresolved discussions (waiting on @ilyalesokhin-starkware and @TomerStarkware)
crates/cairo-lang-lowering/src/lower/mod.rs
line 1949 at r1 (raw file):
) .map_err(LoweringFlowError::Failed)?; }
we need both?
Suggestion:
add_closure_call_function(
ctx,
expr,
builder.semantics.closures.get(&capture_var_usage.var_id).unwrap(),
if ctx.variables[capture_var_usage.var_id].copyable.is_ok() {
semantic::corelib::fn_trait(ctx.db.upcast())
} else {
semantic::corelib::fn_once_trait(ctx.db.upcast())
},
)
crates/cairo-lang-semantic/src/items/imp.rs
line 1806 at r1 (raw file):
let ret_ty = db.trait_type_by_name(trait_id, "Output".into()).unwrap().unwrap(); (
this is very unclear - use the functions properly, even if it means splitting handle_mem_trait
into another closure.
corelib/src/ops/function.cairo
line 33 at r1 (raw file):
pub trait Fn<T, Args> { /// The returned type after the call operator is used.
Suggestion:
/// Instances of `Fn` can be called multiple times.
///
/// `Fn` is implemented automatically by closures that capture only copyable variables.
pub trait Fn<T, Args> {
/// The returned type after the call operator is used.
42020d5
to
72d0fba
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: 14 of 16 files reviewed, 3 unresolved discussions (waiting on @ilyalesokhin-starkware and @orizi)
crates/cairo-lang-lowering/src/lower/mod.rs
line 1949 at r1 (raw file):
Previously, orizi wrote…
we need both?
Done.
crates/cairo-lang-semantic/src/items/imp.rs
line 1806 at r1 (raw file):
Previously, orizi wrote…
this is very unclear - use the functions properly, even if it means splitting
handle_mem_trait
into another closure.
Done.
corelib/src/ops/function.cairo
line 33 at r1 (raw file):
pub trait Fn<T, Args> { /// The returned type after the call operator is 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 3 of 3 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware)
No description provided.