diff options
author | Chris Smith <cdsmith@gmail.com> | 2018-11-17 12:40:23 +0100 |
---|---|---|
committer | Krzysztof Gogolewski <krz.gogolewski@gmail.com> | 2018-11-17 13:52:26 +0100 |
commit | 0e7790abf7d19d19f84c86dc95e50beb65462d12 (patch) | |
tree | 4868453d4f01abd14543317e7a0e3a93d73f2d19 /compiler | |
parent | 798c943781e14b7111431d3c7193c93fcc5ffa3e (diff) | |
download | haskell-0e7790abf7d19d19f84c86dc95e50beb65462d12.tar.gz |
Fix trac #15702, as a followon to fix for #13704.
Summary:
The effect of this change is that -main-is changes the default
export list for the main module, but does not apply the same
change to non-main modules. This fixes some cases where -main-is
was used to wrap a module that expected that default behavior
(exporting `main`, even when that wasn't the main entry point
name).
Reviewers: mpickering, monoidal, bgamari
Subscribers: rwbarton, carter
GHC Trac Issues: #13704, #15702
Differential Revision: https://phabricator.haskell.org/D5322
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/typecheck/TcRnExports.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/typecheck/TcRnExports.hs b/compiler/typecheck/TcRnExports.hs index 1b57608a41..a2f892ba1e 100644 --- a/compiler/typecheck/TcRnExports.hs +++ b/compiler/typecheck/TcRnExports.hs @@ -127,9 +127,11 @@ tcRnExports explicit_mod exports -- In interactive mode, we behave as if he had -- written "module Main where ..." ; dflags <- getDynFlags + ; let is_main_mod = mainModIs dflags == this_mod ; let default_main = case mainFunIs dflags of - Just main_fun -> mkUnqual varName (fsLit main_fun) - Nothing -> main_RDR_Unqual + Just main_fun + | is_main_mod -> mkUnqual varName (fsLit main_fun) + _ -> main_RDR_Unqual ; let real_exports | explicit_mod = exports | ghcLink dflags == LinkInMemory = Nothing |