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

Variable scoping changes on import #733

Open
kentslaney opened this issue Oct 19, 2024 · 2 comments
Open

Variable scoping changes on import #733

kentslaney opened this issue Oct 19, 2024 · 2 comments
Labels
bug Something isn't working compilation Compilation of terms and functions to HVM

Comments

@kentslaney
Copy link
Contributor

kentslaney commented Oct 19, 2024

Reproducing the behavior

with the following 2 files...

imported.bend

def test(key):
  return key + 1

def key(seed):
  return seed + 2

def main:
  return test(5)

 

importer.bend

from imported import test

def main:
  return test(5)

running the two files gives different results, when the expected result is the same since they're making the same call (using bend run)

System Settings

  • HVM: 2.0.22
  • Bend: 0.2.37
  • OS: archlinux:latest docker image
  • CPU: AMD Ryzen 9

Additional context

I think this might be related to #729 but I opened a new issue since it doesn't fail at compile time

@kentslaney
Copy link
Contributor Author

kentslaney commented Oct 19, 2024

It might be a separate issue, but I've also found that importing functions that use fold and bend or list concatenations have altered behavior.

TODO: minimum reproducible example

@developedby
Copy link
Member

It's not related to that issue. The variable use key is being replaced by the key function. There's some issue with the name substitution that is not considering shadowing correctly here.

@developedby developedby added bug Something isn't working compilation Compilation of terms and functions to HVM labels Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compilation Compilation of terms and functions to HVM
Projects
None yet
Development

No branches or pull requests

2 participants