elm-codegen
elm-codegen copied to clipboard
Broken import statements when local module uses import aliases
For example, this file:
module BadModuleNamedWith exposing (dummyDecoder)
import Json.Decode as JD
dummyDecoder : JD.Decoder String
dummyDecoder =
JD.succeed ""
would produce Gen code containing:
{-| dummyDecoder: JD.Decoder String -}
dummyDecoder : Elm.Expression
dummyDecoder =
Elm.value
{ importFrom = [ "BadModuleNamedWith" ]
, name = "dummyDecoder"
, annotation = Just (Type.namedWith [ "JD" ] "Decoder" [ Type.string ])
}
which would then produce generated code that contains import JD instead of import Json.Decode.
I've added a test case to demonstrate: 3e7c05574c315658e77ddae4948c96b3386b4817
Thanks for creating elm-codegen, it's fantastic! :pray: