elm-lang / elm-make

A build tool for Elm projects
BSD 3-Clause "New" or "Revised" License
175 stars 45 forks source link

Output of "elm-make" fails to pass the Closure compiler #185

Closed nikita-volkov closed 6 years ago

nikita-volkov commented 6 years ago

Following is the error I get from Closure:

ERROR - Duplicate let / const / class / function declaration in the same scope is not allowed.
function badIndex(index, nestedProblems)
         ^^^^^^^^

The version is:

elm-make 0.18 (Elm Platform 0.18.0)
process-bot commented 6 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

evancz commented 6 years ago

This particular thing seems to be caused by a mistake in the Json.Decode implementation that was fixed elsewhere, but I am reading this as a feature request for code gen to produce code compatible with Closure Compiler. I think doing that makes sense, but I do not want to track requests in issues.

For some longer term perspective, I think we can do much better by analyzing things within Elm because we have so many more guarantees. The compiler can make more assumptions and be more aggressive. That said, compatibility with Closure Compiler will be a bit better in the next release.