Skip to content

Commit

Permalink
fix: irrelevant order var load in the lambda (#1704)
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy authored Oct 21, 2024
1 parent 53ebd23 commit dbb5cb0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kclvm/evaluator/src/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ impl<'ctx> Evaluator<'ctx> {
self.is_local_var(name),
) {
// Get variable from the global lazy scope.
(false, false, false) => {
(false, _, false) => {
let variable = self.get_variable(name);
match self.resolve_variable_level(name) {
// Closure variable or local variables
Expand Down
9 changes: 9 additions & 0 deletions test/grammar/schema/irrelevant_order/simple_11/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
v = f1()

f0 = lambda {
"value"
}

f1 = lambda {
{f0 = f0()}
}
2 changes: 2 additions & 0 deletions test/grammar/schema/irrelevant_order/simple_11/stdout.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
v:
f0: value

0 comments on commit dbb5cb0

Please sign in to comment.