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

CallExpression uses incorrect scope for parameters evaluation #706

Closed
sys27 opened this issue Sep 4, 2023 · 0 comments · Fixed by #707
Closed

CallExpression uses incorrect scope for parameters evaluation #706

sys27 opened this issue Sep 4, 2023 · 0 comments · Fixed by #707
Assignees
Labels
Milestone

Comments

@sys27
Copy link
Owner

sys27 commented Sep 4, 2023

Describe the bug
CallExpression has access to nested captured scope when evaluating lambda parameters.

To Reproduce
Steps to reproduce the behavior:

  1. f := (x) => (y) => x + y
  2. add1 := f(1)
  3. add1(x + 2)

Expected behavior
add1(x + 2) returns an error because the x variable is not defined in the "global" scope.

Actual behavior
add1(x + 2) returns 4 because the call expression uses the captured scope where the x variable is a lambda parameter equal to 1. So, x = 1 and y = x + 2 = 3 -> x + y = 4

@sys27 sys27 added the bug label Sep 4, 2023
@sys27 sys27 added this to the xFunc 4.4.0 milestone Sep 4, 2023
@sys27 sys27 self-assigned this Sep 4, 2023
@sys27 sys27 closed this as completed in #707 Sep 4, 2023
sys27 added a commit that referenced this issue Sep 4, 2023
#706 - CallExpression uses incorrect scope for parameters evaluation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant