Skip to content

"Prelude.last: empty list" crash when module path appears to conflict with core module #2345

@adamdicarlo0

Description

@adamdicarlo0

When a .elm file in source-directories appears to have the module name of an auto-imported core module, elm make crashes:

Detected problems in 1 module.
-- AMBIGUOUS IMPORT ----------------------------------------------- src/Main.elm

You are trying to import a `Platform` module:

elm: Prelude.last: empty list
CallStack (from HasCallStack):
  error, called at libraries/base/GHC/List.hs:1644:3 in base:GHC.List
  errorEmptyList, called at libraries/base/GHC/List.hs:158:13 in base:GHC.List
  lastError, called at libraries/base/GHC/List.hs:153:29 in base:GHC.List
  last, called at compiler/src/Reporting/Render/Code.hs:102:26 in main:Reporting.Render.Code

In this case, the "ambiguous" extra module starts out with:

module Gen.Platform exposing (...)

but it is placed directly in a folder listed in source-directories.

I believe this only happens for implicitly-imported core modules like Platform. I have not verified it.

SSCCE with slightly more information in README: https://github.com/adamdicarlo0/elm-compiler-empty-list-bug

Elm compiler version 0.19.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions