[commit: ghc] master: Error out on `Main` without `main` in GHCi (#7765) (0fa2072)
git at git.haskell.org
git at git.haskell.org
Mon Feb 23 09:40:21 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/0fa20726b0587530712677e50a56c2b03ba43095/ghc
>---------------------------------------------------------------
commit 0fa20726b0587530712677e50a56c2b03ba43095
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date: Mon Feb 23 03:38:26 2015 -0600
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
>---------------------------------------------------------------
0fa20726b0587530712677e50a56c2b03ba43095
compiler/typecheck/TcRnDriver.hs | 37 +++++++---------------
compiler/typecheck/TcRnMonad.hs | 5 +--
compiler/typecheck/TcRnTypes.hs | 4 ++-
compiler/utils/IOEnv.hs | 9 +++---
docs/users_guide/7.12.1-notes.xml | 3 +-
testsuite/tests/deriving/should_fail/T5686.hs | 2 +-
.../tests/ghci/prog012/{Main.hs => FooBar.hs} | 2 +-
testsuite/tests/ghci/prog012/prog012.script | 2 +-
testsuite/tests/ghci/scripts/ghci022.hs | 2 +-
testsuite/tests/ghci/scripts/ghci027.script | 4 +--
testsuite/tests/ghci/scripts/ghci027_1.hs | 2 +-
testsuite/tests/ghci/scripts/ghci027_2.hs | 2 +-
.../{ghci/scripts/ghci022.hs => module/T7765.hs} | 1 -
testsuite/tests/module/T7765.stderr | 2 ++
testsuite/tests/module/all.T | 4 +--
testsuite/tests/module/mod174.hs | 9 ------
testsuite/tests/module/mod174.stderr | 3 --
testsuite/tests/parser/should_fail/readFail013.hs | 2 +-
18 files changed, 36 insertions(+), 59 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 0fa20726b0587530712677e50a56c2b03ba43095
More information about the ghc-commits
mailing list