elm / compiler

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

Confusing error when trying to compile a module with a duplicate name #2173

Open nonpop opened 3 years ago

nonpop commented 3 years ago

Quick Summary: Trying to compile a module with a name that's used by another module eg. Process (conflicting with the one in elm/core) results in an error message which basically seems to say it's a compiler bug.

SSCCE

src/Process.elm:

module Process exposing (foo)
foo = ()

elm.json:

{
    "type": "application",
    "source-directories": [
        "src"
    ],
    "elm-version": "0.19.1",
    "dependencies": {
        "direct": {
            "elm/core": "1.0.5",
            "elm/json": "1.1.3"
        },
        "indirect": {}
    },
    "test-dependencies": {
        "direct": {},
        "indirect": {}
    }
}

Now say elm make src/Process.elm and you get this message:

$  elm make src/Process.elm 
Success!     

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

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

>   Error from `Process` 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 `Process` should have been reported already.
CallStack (from HasCallStack):
  error, called at builder/src/Build.hs:1233:29 in main:Build
github-actions[bot] commented 3 years ago

Thanks for reporting this! To set expectations:

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