-
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
Undefined variable being passed to a function does not raise compiler error #1063
Comments
But isn't the problem that What I mean is that the compiler would detect a completely undefined variable -- what it's not detecting here is something different, that is, a recursive definition that doesn't make sense. |
I have only read the title of this issue, but there's a very high chance this is a duplicate of #873. Can you take a look at all the issues that reference it and see if this looks the same? |
It looks the same. |
Okay, cool! The plan is to have this fixed in 0.16. We know where the code should go and how it should work, just need to write it down :) So look out for the fix in the next release. If you want to follow along, I may do an update on #873 when it is fixed in the master branch of the compiler. Thanks for the report, and sorry you ran into this! 0.16 also has stuff like "recognize when a |
And @rgrempel's explanation is a good way to think of this. Elm allows self-recursive values, which is often nice. Like for functions. We did not know exactly how to restrict it to disallow just the bad cases (like the one you ran into) until relatively recently. |
Deep down in the "cases" of my
update
function, there is this:Where I passed that last
board
argument I should have passedmodel.board
, but I made this mistake, and the compiler did not complain. Now I tried replacingboard
for other arbitrary names, but then the compiler noted the mistake and compilation failed.Then I tried the following:
and the compiler allowed.
Running the program compiled this way I get a runtime error somewhere where I needed a property of
model.board
:'columns'
is a property ofmodel.board
, but here's where I think the problem could be better inspected, in the generated code forBoardAction
:or, in the printscreen version with all the important values:
The text was updated successfully, but these errors were encountered: