elm / compiler

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

Shadowing is allowed for importing types #2277

Open jfmengels opened 1 year ago

jfmengels commented 1 year ago

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

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.

github-actions[bot] commented 1 year ago

Thanks for reporting this! To set expectations:

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