[GHC] #13838: -Wdeferred-type-errors on a program with main not of type IO () yields "main thread exited (uncaught exception)"
GHC
ghc-devs at haskell.org
Wed May 30 20:30:56 UTC 2018
#13838: -Wdeferred-type-errors on a program with main not of type IO () yields
"main thread exited (uncaught exception)"
-------------------------------------+-------------------------------------
Reporter: harry | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
crash or panic | Test Case:
Blocked By: | Blocking:
Related Tickets: #13292 | Differential Rev(s): Phab:D4708
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari <ben@…>):
In [changeset:"49e423e9940a9122a4a417cfc7580b9984fb49eb/ghc"
49e423e9/ghc]:
{{{
#!CommitTicketReference repository="ghc"
revision="49e423e9940a9122a4a417cfc7580b9984fb49eb"
Put the `ev_binds` of main function inside `runMainIO`
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
errors.
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
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13838#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list