summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2015-02-23 03:38:26 -0600
committerAustin Seipp <austin@well-typed.com>2015-02-23 03:38:27 -0600
commit0fa20726b0587530712677e50a56c2b03ba43095 (patch)
treeb82eaaf4828a17dfc72845ac11a918feed801bc3 /testsuite/tests/ghci
parentb2be772a97f6e7fe9f1d1c28108949f81a13158b (diff)
downloadhaskell-0fa20726b0587530712677e50a56c2b03ba43095.tar.gz
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
Diffstat (limited to 'testsuite/tests/ghci')
-rw-r--r--testsuite/tests/ghci/prog012/FooBar.hs (renamed from testsuite/tests/ghci/prog012/Main.hs)2
-rw-r--r--testsuite/tests/ghci/prog012/prog012.script2
-rw-r--r--testsuite/tests/ghci/scripts/ghci022.hs2
-rw-r--r--testsuite/tests/ghci/scripts/ghci027.script4
-rw-r--r--testsuite/tests/ghci/scripts/ghci027_1.hs2
-rw-r--r--testsuite/tests/ghci/scripts/ghci027_2.hs2
6 files changed, 7 insertions, 7 deletions
diff --git a/testsuite/tests/ghci/prog012/Main.hs b/testsuite/tests/ghci/prog012/FooBar.hs
index d49d063551..eeb29bbdbb 100644
--- a/testsuite/tests/ghci/prog012/Main.hs
+++ b/testsuite/tests/ghci/prog012/FooBar.hs
@@ -1,4 +1,4 @@
-module Main where
+module FooBar where
import Foo
import Bar
diff --git a/testsuite/tests/ghci/prog012/prog012.script b/testsuite/tests/ghci/prog012/prog012.script
index 49af938b75..5e178389ac 100644
--- a/testsuite/tests/ghci/prog012/prog012.script
+++ b/testsuite/tests/ghci/prog012/prog012.script
@@ -10,7 +10,7 @@
:shell cp Bar1.hs Bar.hs
-:load Main.hs
+:load FooBar.hs
:shell sleep 1
:shell cp Bar2.hs Bar.hs
diff --git a/testsuite/tests/ghci/scripts/ghci022.hs b/testsuite/tests/ghci/scripts/ghci022.hs
index d49fdba319..f87946a758 100644
--- a/testsuite/tests/ghci/scripts/ghci022.hs
+++ b/testsuite/tests/ghci/scripts/ghci022.hs
@@ -1,2 +1,2 @@
-module Main where
+module GHCi022 where
'a' '
diff --git a/testsuite/tests/ghci/scripts/ghci027.script b/testsuite/tests/ghci/scripts/ghci027.script
index aaf0ac5544..7a24f527bb 100644
--- a/testsuite/tests/ghci/scripts/ghci027.script
+++ b/testsuite/tests/ghci/scripts/ghci027.script
@@ -1,8 +1,8 @@
-- Test for #1617
:!cp ghci027_1.hs ghci027.hs
:load ghci027
-:browse *Main
+:browse *T1617
:!sleep 1
:!cp ghci027_2.hs ghci027.hs
:reload
-:browse *Main
+:browse *T1617
diff --git a/testsuite/tests/ghci/scripts/ghci027_1.hs b/testsuite/tests/ghci/scripts/ghci027_1.hs
index a1a7bfac37..23d52f0fee 100644
--- a/testsuite/tests/ghci/scripts/ghci027_1.hs
+++ b/testsuite/tests/ghci/scripts/ghci027_1.hs
@@ -1,5 +1,5 @@
-- Test for #1617
-module Main where
+module T1617 where
import Prelude ()
import Control.Monad (mplus)
import qualified Control.Monad (mplus)
diff --git a/testsuite/tests/ghci/scripts/ghci027_2.hs b/testsuite/tests/ghci/scripts/ghci027_2.hs
index df99d7d1c0..c4db784dc2 100644
--- a/testsuite/tests/ghci/scripts/ghci027_2.hs
+++ b/testsuite/tests/ghci/scripts/ghci027_2.hs
@@ -1,5 +1,5 @@
-- Test for #1617
-module Main where
+module T1617 where
import Prelude ()
--import Control.Monad (mplus)
import qualified Control.Monad (mplus)