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

Compilation warning #4

Open
tmbb opened this issue Jul 30, 2017 · 6 comments
Open

Compilation warning #4

tmbb opened this issue Jul 30, 2017 · 6 comments

Comments

@tmbb
Copy link
Contributor

tmbb commented Jul 30, 2017

Unsafe variable found at:
  lib/ex_spirit/parser.ex:1315

warning: the variable "context" is unsafe as it has been set inside one of: case, cond, receive, if, and, or, &&, ||. Please explicitly return the variable value instead. For example:

    case integer do
      1 -> atom = :one
      2 -> atom = :two
    end

should be written as

    atom =
      case integer do
        1 -> :one
        2 -> :two
      end

Unsafe variable found at:
  lib/ex_spirit/parser.ex:1317
@OvermindDL1
Copy link
Owner

OvermindDL1 commented Jul 31, 2017

Yeah that is because of some Elixir utter stupidity in that it leaks bindings out of case statements (and later Elixir realized how stupid that was so put a warning about it). The only way to fix it since I am generating massively nested case's is to generate new atom names, which balloons the atom table, and thus I do not really want to do that. I might though, it will fix this warnings. Even with the warnings it should not cause errors during run though, it is just an Elixir massive mis-design. I'll leave this open to remind me to generate unique atom names later (maybe behind an option?).

@tmbb
Copy link
Contributor Author

tmbb commented Jul 31, 2017

Is there any way to disable that warning? Per file or even per project?

@OvermindDL1
Copy link
Owner

Is there any way to disable that warning? Per file or even per project?

Hmm, I've not actually checked, I've always left the warning to remind me to do something about it later (it would not even be an issue if elixir did not leak bindings outside their scope to begin with...)...

From some quick googling I'm not finding any way to disable that warning explicitly and it seems they don't want to add such a way to disable it considering the pattern (which does not actually exist here, just macro's acting oddly in certain recursive patterns) is a bad pattern that should have never existed to begin with.

Keep poking me on occasion, I'm in a crunch period this and next week but I should be able to get time after that (maybe before at home sometimes?) to fix it in ExSpirit. It would help a LOT if you could give me a minimal reproducable example that causes that warning so I don't have to trace through every line individually, with such a minimal example I could fix it a lot sooner. ^.^

@tmbb
Copy link
Contributor Author

tmbb commented Jul 31, 2017

It would help a LOT if you could give me a minimal reproducable example that causes that warning so I don't have to trace through every line individually, with such a minimal example I could fix it a lot sooner. ^.^

Sure, I'll try!

@tmbb
Copy link
Contributor Author

tmbb commented Mar 1, 2018

Just a warning that this will turn into an error in Elixir 1.7

@OvermindDL1
Copy link
Owner

Well it's not actually 'used', so I don't even know why elixir says it is leaking out, that functionality needs to be entirely removed and I can't wait until it is (bindings should not leak out of scopes!). ^.^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants