Skip to content

Infinite loops on type solver issue affecting elm/compiler #116

Description

@rupertlssmith

SSCCE

module Try exposing (..)

f x =
    let
        g : (a -> ()) -> ()
        g h =
            h x
    in
    x


main : Platform.Program () () ()
main =
    Platform.worker
        { init = \_ -> ( (), Cmd.none )
        , update = \_ _ -> ( (), Cmd.none )
        , subscriptions = \_ -> Sub.none
        }

When compiling this with guida make, the compiler appears to infinite loop. The main is just there so you can compile this as an application.

Removing the type annotation on g it will run fine.
Add the type annotation f : a -> a it will also run fine.

The problem is potentially around introducing a new type variable in a let..in that affects the overall type of the outer function?

On the elm compiler, the compiler crashes with rank = 2: elm#2301

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Fields

    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