Skip to content
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.

Projects intermittently say they compile successfully, when they are actually broken. #107

Closed
@krisajenkins

Description

Intermittently, I run elm make, and it says everything compiles successfully, but the app fails at runtime with various errors related to a function missing or a type definition being incorrect. Recompiling doesn't fix it (because it thinks there's no work to do). But deleting elm-stuff/build-artifacts and recompiling reveals a compiler error/warning. Running touch src/**/*.elm and recompiling also surfaces the missing error message.

The exact symptoms and circumstances change, but the problem boils down to, elm make thinks the project is completely and correctly compiled, but it's wrong. Forcing it to recompile completely spots an error.

Quite a few people have seen this issue now, and it's getting so "delete elm-stuff/build-artifacts," is become go-to advice. :-(

Below is my best effort at a SSCCE. It creates two small files, one of which depends on the other. Then it compiles them successfully. Next it changes them in a way that should break the project and recompiles. It ought to give this error:

-- TYPE MISMATCH ------------------------------------------------------- Bar.elm

The type annotation for `bar` does not match its definition.

6| bar : Foo
         ^^^
The type annotation is saying:

    String

But I am inferring that the definition has this type:

    number

Detected errors in 1 module.  

...but I just ran it 10 times in a row and in 9 of those it said everything had recompiled fine. Only one run correctly reported the error.

The script is here: https://gist.github.com/krisajenkins/8b2de1d221f2c26a55b6fa1a02dfc74d

It definitely reveals there's a problem with the dependency-tree calculation. Hopefully it's the same one that's been causing problems in the large.

Notes:
The first time you run it it'll download the core libs, so expect the first run to take a minute.
I'm asking you to run a shell script here, so do read it over first. You'll see it just creates two files Foo.elm and Bar.elm and runs elm-make. It's harmless, but don't blindly take my word for it.)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions