elm / error-message-catalog

A catalog of broken Elm programs / data to improve error messages
BSD 3-Clause "New" or "Revised" License
174 stars 17 forks source link

Trying to use non-exposed constructors #355

Open Janiczek opened 1 year ago

Janiczek commented 1 year ago
module File1 exposing (CustomType)

type CustomType
  = Foo
  | Bar
module File2 exposing (usage)

import File1 exposing (CustomType(..))

usage =
    Foo

This will currently get you:

-- NAMING ERROR -------------------------------------------------- src/File2.elm

I cannot find a `Foo` variant:

7|     Foo
       ^^^
These names seem close though:

    Ok
    EQ
    Err
    GT

Hint: Read <https://elm-lang.org/0.19.1/imports> to see how `import`
declarations work in Elm.

while it could give you something like

-- IMPORT ERROR -------------------------------------------------- src/File2.elm

You're trying to import the constructors of the `CustomType` type:

3| import File1 exposing (CustomType(..))
                                    ^^^^

The module File1 doesn't expose them though.