-
Notifications
You must be signed in to change notification settings - Fork 658
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
Assigning a variable to itself when defining that variablee #1049
Comments
I'm pretty certain this is already covered by other issues. Have you looked? |
I looked with keywords such as |
I was thinking about various issues with recursive definitions. The following one seems the most encompassing one at the moment: #873. At its bottom it lists several related ones. Maybe your example adds some new aspect, so instead of closing the issue right away, maybe you can first look through the referenced ones to see whether it is already covered. |
Yeah, it's a known issue. Even |
I'm working on a fix for this, since it's related to DeadCode elimination. Please close this issue, since it's covered by #873 . |
Elm seems to not catch the issue in which a variable is defined using a self-asignment or a calculation that involves itself.
A modified version of the Hello World Example:
As you can see, this is a clear mistake, but the compiler doesn't seem to detect this. It's quite an annoying error as it's hard to debug such issues when finding in your code.
An even more rediculous example (based on the previous example) that compiles is:
It's the same kind of error, whereby you use a variable before it is defined.
Would be great if such code get's flagged as an error with a message such as "Error: Using variable 'x' before it is defined at Line ?"
The text was updated successfully, but these errors were encountered: