• Tao He's avatar
    Put the `ev_binds` of main function inside `runMainIO` · 49e423e9
    Tao He authored
    This ensures that the deferred type error can be emitted correctly.
    For `main` function in `Main` module, we have
        :Main.main = GHC.TopHandler.runMainIO main
    When the type of `main` is not `IO t` and the
    `-fdefer-type-errors` is enabled, the `ev_binds`
    of `main` function will contain deferred type
    Previously, the `ev_binds` are bound to `runMainIO main`,
    rather than `main`, the type error exception at runtime
    cannot be handled properly. See Trac #13838.
    This patch fix that.
    Test Plan: make test TEST="T13838"
    Reviewers: bgamari
    Reviewed By: bgamari
    Subscribers: rwbarton, thomie, carter
    GHC Trac Issues: #13838
    Differential Revision: https://phabricator.haskell.org/D4708
TcRnDriver.hs 113 KB