compiler icon indicating copy to clipboard operation
compiler copied to clipboard

Compiler crash on external module name duplicate

Open csaltos opened this issue 4 years ago • 1 comments

First of all, thank you Evan for Elm, it's great and it brings me new joy to programming in my life and with my company and colleges !!

Quick Summary: if you import a dependency with the same name of one of your modules, the compiler crashes

SSCCE

src/Countries.elm:

module Countries exposing (dummy)

dummy : Int
dummy = 1

elm.json:

{
    "type": "application",
    "source-directories": [
        "src"
    ],
    "elm-version": "0.19.1",
    "dependencies": {
        "direct": {
            "elm/browser": "1.0.2",
            "elm/core": "1.0.5",
            "elm/html": "1.0.0",
            "supermario/elm-countries": "1.1.1"
        },
        "indirect": {
            "elm/json": "1.1.3",
            "elm/time": "1.0.0",
            "elm/url": "1.0.0",
            "elm/virtual-dom": "1.0.2"
        }
    },
    "test-dependencies": {
        "direct": {},
        "indirect": {}
    }
}
  • Elm: 0.19.1
  • Browser: Firefox 91.0.2
  • Operating System: Ubuntu Linux 20.04 LTS

Additional Details

Compiler error:

-- ERROR -----------------------------------------------------------------------

I ran into something that bypassed the normal error reporting process! I
extracted whatever information I could from the internal error:

>   Error from `Countries` should have been reported already.
>   CallStack (from HasCallStack):
>     error, called at builder/src/Build.hs:1233:29 in main:Build

These errors are usually pretty confusing, so start by asking around on one of
forums listed at https://elm-lang.org/community to see if anyone can get you
unstuck quickly.

-- REQUEST ---------------------------------------------------------------------

If you are feeling up to it, please try to get your code down to the smallest
version that still triggers this message. Ideally in a single Main.elm and
elm.json file.

From there open a NEW issue at https://github.com/elm/compiler/issues with your
reduced example pasted in directly. (Not a link to a repo or gist!) Do not worry
about if someone else saw something similar. More examples is better!

This kind of error is usually tied up in larger architectural choices that are
hard to change, so even when we have a couple good examples, it can take some
time to resolve in a solid way.elm: Error from `Countries` should have been reported already.
CallStack (from HasCallStack):
  error, called at builder/src/Build.hs:1233:29 in main:Build

NOTE: the solution is kind of easy, just rename the clashing module to something else but finding that is the cause of the error was long and a pain ... I hope a solution can be discovered since this happens with any external module name clashing.

Once again, thank you very much !!

csaltos avatar Sep 14 '21 13:09 csaltos

Thanks for reporting this! To set expectations:

  • Issues are reviewed in batches, so it can take some time to get a response.
  • Ask questions in a community forum. You will get an answer quicker that way!
  • If you experience something similar, open a new issue. We like duplicates.

Finally, please be patient with the core team. They are trying their best with limited resources.

github-actions[bot] avatar Sep 14 '21 13:09 github-actions[bot]