elm/compiler

Shadowing is allowed for importing types

jfmengels opened this issue · 1 comments

Quick Summary: It is possible to shadow types, even though this is discouraged, and usually a compiler error

SSCCE

import A exposing (SomeType)
import B exposing (SomeType)

a : SomeType
a = B.value
module A exposing (SomeType, value)
type SomeType = SomeType
value = SomeType
module B exposing (SomeType, value)
type SomeType = SomeType
value = SomeType
  • Elm: 0.19.1
  • Browser: NA
  • Operating System: NA

Additional Details

This can be confusing, because it is not clear which SomeType is actually chosen. The order of imports seem to be deciding this.

This kind of shadowing is not as problematic as for functions or values, but I think there is value in keeping this consistent.

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.