[GHC] #414: GHC does not eforce that Main exports main

GHC ghc-devs at haskell.org
Mon Feb 23 09:40:16 UTC 2015


#414: GHC does not eforce that Main exports main
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                   Owner:  igloo
            Type:  merge             |                  Status:  closed
        Priority:  lowest            |               Milestone:  6.12.2
       Component:  Compiler          |                 Version:  6.10.4
      Resolution:  fixed             |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |  module/T414
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by Austin Seipp <austin@…>):

 In [changeset:"0fa20726b0587530712677e50a56c2b03ba43095/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="0fa20726b0587530712677e50a56c2b03ba43095"
 Error out on `Main` without `main` in GHCi (#7765)

 Summary:
 GHC does 2 validation checks for module `Main`:
 * does `main` exist
 * is `main` exported (#414)

 The second check is done in ghc as well as in ghci (and runghc and ghc
 -e).
 The first check however is currently not done in ghci, to prevent "'main'
 is
 not in scope" errors when loading simple scripts. See commit d28ba8c8009
 for
 more information.

 This commit tightens the special case for ghci. When the file does not
 contain
 a main function, but does contain an explicit module header (i.e. "module
 Main
 where"), then /do/ raise an error in ghci (and runghc and ghc -e) as well

 Test Plan:
 module/T7765: a module Main with an explicit module header but without a
 main function should be an error for all Ways.

 Additionaly: delete test module/mod174. It was added in commit 5a54c38,
 but it
 is a duplicate of module/T414.

 Reviewers: austin

 Reviewed By: austin

 Subscribers: thomie

 Differential Revision: https://phabricator.haskell.org/D649

 GHC Trac Issues: #7765
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/414#comment:15>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list