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

References with names bound by a match term are not shadowed #718

Open
developedby opened this issue Sep 20, 2024 · 1 comment
Open

References with names bound by a match term are not shadowed #718

developedby opened this issue Sep 20, 2024 · 1 comment
Labels
bug Something isn't working compilation Compilation of terms and functions to HVM

Comments

@developedby
Copy link
Member

Reproducing the behavior

Consider this program

x.head = 0
x.tail = 1

main = match x=[1] {
  List/Cons: @x (x x.head x.tail)
  List/Nil: 0
}

Here, x.head and x.tail should refer to the variables bound by the elimination of List/Cons. Instead they resolved as references to the two functions.

We can reproduce this by running the program, which results in λa (a x.head x.tail) instead o λa (a 1 []) which we get by calling x any other name.

This happens because resolve_refs is called before fix_match_terms and so the names bound by each match arm haven't been generated yet.

System Settings

Bend commit 45839a7

Additional context

No response

@developedby developedby added bug Something isn't working compilation Compilation of terms and functions to HVM labels Sep 23, 2024
@developedby
Copy link
Member Author

The same thing happens with the terms that desugar to matches, like fold and open, but not with pattern matching functions, since they hold their variables differently.

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

1 participant