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

where clauses in function definitions leak out and impact global definitions #676

Open
eminence opened this issue Jan 1, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@eminence
Copy link
Contributor

eminence commented Jan 1, 2025

Consider this function:

fn foo(x: Scalar) -> Scalar = x + something where something = 1

Ideally we'd like and expect that something is locally scoped to this function definition. But it's name leaks out and prevents the name something from being used in some contexts (like unit definitions):

>>> unit something
error: identifier clash in definition
  ┌─ <input:2>:1:51
  │
1 │ fn foo(x: Scalar) -> Scalar = x + something where something = 1
  │                                                   --------- Previously defined here
  │
  ┌─ <input:4>:1:6
  │
1 │ unit something
  │      ^^^^^^^^^ identifier is already in use

@sharkdp sharkdp added the bug Something isn't working label Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants