Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

added Fn trait #6659

wants to merge 1 commit into from

Conversation

TomerStarkware
Copy link
Collaborator

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator

@orizi orizi left a 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.

Copy link
Collaborator Author

@TomerStarkware TomerStarkware left a 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.

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 3 of 3 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants