elm / compiler

Compiler for Elm, a functional language for reliable webapps.
https://elm-lang.org/
BSD 3-Clause "New" or "Revised" License
7.54k stars 663 forks source link

Name conflict with non-exported module in dependency #1649

Open drathier opened 7 years ago

drathier commented 7 years ago

Elm-test contains a non-exported Util.elm. My own code that depends on and uses elm-test also has a Util.elm. The first compilation when running elm-test works fine, but the second time, it tries to import the wrong Util.elm. Deleting elm-stuff fixes it.

SSCCE available at https://github.com/drathier/sscce-elm-test-util

OSX 10.11.6 elm-make 0.18 (Elm Platform 0.18.0) elm-test 0.18.7

process-bot commented 7 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.

eeue56 commented 7 years ago

Found the problem: the elm-package.json in the tests folder uses:

"repository": "https://github.com/elm-community/elm-test.git"

which means that the package names collide after an initial compile.

drathier commented 7 years ago

So, untested summary: If your repository path exactly matches one of your dependencies, you might get the dependency's version of a file, but only after having compiled your project once already. If the thing you import exists in both packages, and their types match, presumably you could get the wrong behavior without any warning.