-
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
added calling expressions on closures #6192
Conversation
c643d46
to
e957ee9
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 3 files at r1, 1 of 2 files at r2, all commit messages.
Reviewable status: 2 of 3 files reviewed, 7 unresolved discussions (waiting on @ilyalesokhin-starkware and @TomerStarkware)
crates/cairo-lang-semantic/src/expr/compute.rs
line 146 at r2 (raw file):
cfg_set: Arc<CfgSet>, /// whether to look for closures when calling variables. /// TODO(TomerStarkware): Remove this once we disallow calling overshadowed functions.
Suggestion:
/// whether to look for closures when calling variables.
/// TODO(TomerStarkware): Remove this once we disallow calling shadowed functions.
crates/cairo-lang-semantic/src/expr/compute.rs
line 880 at r2 (raw file):
} ResolvedConcreteItem::Function(function) => { if is_over_shadow_by_variable {
Suggestion:
if is_shadowed_by_variable {
crates/cairo-lang-semantic/src/expr/test_data/closure
line 297 at r2 (raw file):
error: Trait has no implementation in context: core::traits::Into::<core::integer::u256, core::integer::u32>. --> lib.cairo:3:22 a.into() + b.into() + c.into()
have a tests without diagnostics.
also explain why there's only one.
crates/cairo-lang-semantic/src/expr/test_data/closure
line 302 at r2 (raw file):
//! > ========================================================================== //! > Test overshadowing a function with a variable.
Suggestion:
Test shadowing of a function with a variable.
crates/cairo-lang-semantic/src/expr/test_data/closure
line 305 at r2 (raw file):
//! > test_runner_name test_function_diagnostics(expect_diagnostics: true)
Suggestion:
test_function_diagnostics(expect_diagnostics: warnings_only)
crates/cairo-lang-semantic/src/expr/test_data/closure
line 329 at r2 (raw file):
//! > ========================================================================== //! > Test overshadowing a function with a variable when closure are in context.
Suggestion:
//! > Test shadowing a function with a variable when closure are in context.
crates/cairo-lang-semantic/src/expr/test_data/closure
line 368 at r2 (raw file):
//! > ========================================================================== //! > Test overshadowing a function with a closure.
Suggestion:
//! > Test shadowing a function with a closure.
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: 2 of 3 files reviewed, 7 unresolved discussions (waiting on @ilyalesokhin-starkware and @orizi)
crates/cairo-lang-semantic/src/expr/compute.rs
line 146 at r2 (raw file):
cfg_set: Arc<CfgSet>, /// whether to look for closures when calling variables. /// TODO(TomerStarkware): Remove this once we disallow calling overshadowed functions.
Done.
crates/cairo-lang-semantic/src/expr/compute.rs
line 880 at r2 (raw file):
} ResolvedConcreteItem::Function(function) => { if is_over_shadow_by_variable {
Done.
crates/cairo-lang-semantic/src/expr/test_data/closure
line 297 at r2 (raw file):
Previously, orizi wrote…
have a tests without diagnostics.
also explain why there's only one.
Done.
crates/cairo-lang-semantic/src/expr/test_data/closure
line 302 at r2 (raw file):
//! > ========================================================================== //! > Test overshadowing a function with a variable.
Done.
crates/cairo-lang-semantic/src/expr/test_data/closure
line 305 at r2 (raw file):
//! > test_runner_name test_function_diagnostics(expect_diagnostics: true)
Done.
crates/cairo-lang-semantic/src/expr/test_data/closure
line 329 at r2 (raw file):
//! > ========================================================================== //! > Test overshadowing a function with a variable when closure are in context.
Done.
crates/cairo-lang-semantic/src/expr/test_data/closure
line 368 at r2 (raw file):
//! > ========================================================================== //! > Test overshadowing a function with a closure.
Done.
e957ee9
to
5cc0ca9
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 2 of 2 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware)
why is this needed? Is this an optimization? Code quote: if ctx.are_closures_in_context { |
why is this cloned? Code quote: arg_types.clone() |
5cc0ca9
to
127417b
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: 2 of 4 files reviewed, 2 unresolved discussions (waiting on @ilyalesokhin-starkware and @orizi)
crates/cairo-lang-semantic/src/expr/compute.rs
line 769 at r3 (raw file):
Previously, ilyalesokhin-starkware wrote…
why is this needed? Is this an optimization?
For now we dont want to break old code which called a function that has the same name has local variable
crates/cairo-lang-semantic/src/expr/compute.rs
line 812 at r3 (raw file):
Previously, ilyalesokhin-starkware wrote…
why is this cloned?
removed
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 2 files at r2, 1 of 2 files at r4.
Reviewable status: 3 of 4 files reviewed, 1 unresolved discussion (waiting on @orizi and @TomerStarkware)
crates/cairo-lang-semantic/src/expr/compute.rs
line 769 at r3 (raw file):
Previously, TomerStarkware wrote…
For now we dont want to break old code which called a function that has the same name has local variable
can't you check the type of the variable instead of checking are_closures_in_context
?
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: 3 of 4 files reviewed, 1 unresolved discussion (waiting on @ilyalesokhin-starkware and @orizi)
crates/cairo-lang-semantic/src/expr/compute.rs
line 769 at r3 (raw file):
Previously, ilyalesokhin-starkware wrote…
can't you check the type of the variable instead of checking
are_closures_in_context
?
The type may also be var or generic.
Also, we eventually want to always look for the impl, and give an error if it is not found, this is just a workaround to not break existing code.
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: 3 of 4 files reviewed, 2 unresolved discussions (waiting on @ilyalesokhin-starkware and @TomerStarkware)
ai8.txt
line 1 at r4 (raw file):
0. before_all: Parameters:
?
127417b
to
9390d2a
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: 3 of 4 files reviewed, 2 unresolved discussions (waiting on @ilyalesokhin-starkware and @orizi)
ai8.txt
line 1 at r4 (raw file):
Previously, orizi wrote…
?
reverted
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: all files reviewed, 1 unresolved discussion (waiting on @ilyalesokhin-starkware)
cc09a80
to
086a183
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 2 files at r3, 1 of 1 files at r5, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @TomerStarkware)
9390d2a
to
80288e5
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 r6, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @TomerStarkware)
80288e5
to
3c85edd
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 r7, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @TomerStarkware)
This change is