Duplicated argument names does not throw an error
b5 opened this issue · comments
fn a a =
a + a
leads to bad things with elm reactor. instead of returing a compiler error, the application seems to compile, but does not behave as expected (I'm getting a page with no elements other than the compiled elm code).
Obviously this is a programmer mistake, but as a newbie this threw me for a minute. Mainly because I'm so trusting of the elm complier :)
Thanks!
This is the wrong repository to file this bug against. The correct repository would be https://github.com/elm-lang/elm-compiler, but I'm sure there is already an issue open there about this.
They do, and it seems to be running just fine in the compiler. Running
fn a a = a
in the repl returns a proper duplicate argument error:
SyntaxError: Strict mode function may not have duplicate parameter names
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:134:18)
at node.js:961:3
however, running this with elm reactor produces the result I described above.
I think you are misunderstanding. Also, I'm not sure what you mean by "They do".
Fact is: The compiler is not treating the case
fn a a = a
correctly.
What you see in the repl is not a message by the compiler, you are seeing a runtime error from the compiled JS. Which is exactly as bad as what you observe in elm-reactor. And just as what you observe in elm-reactor, it is strictly the compiler's fault. So https://github.com/elm-lang/elm-compiler is where this issue should be taken, if there is not already one open there.
Ah I see, my mistake.
Sorry for the ambiguity on "They do". I meant to say that there seems to be an open issue surrounding the topic on the elm-compiler repo. I'll move over to elm-compiler.
Thanks for clarifying!