Commit a21c47c2 authored by batterseapower's avatar batterseapower
Browse files

Use DynFlags.getMainFun in TcRnDriver

parent 47bf4564
...@@ -907,11 +907,7 @@ check_main dflags tcg_env ...@@ -907,11 +907,7 @@ check_main dflags tcg_env
where where
mod = tcg_mod tcg_env mod = tcg_mod tcg_env
main_mod = mainModIs dflags main_mod = mainModIs dflags
main_is_flag = mainFunIs dflags main_fn = getMainFun dflags
main_fn = case main_is_flag of
Just fn -> mkRdrUnqual (mkVarOccFS (mkFastString fn))
Nothing -> main_RDR_Unqual
complain_no_main | ghcLink dflags == LinkInMemory = return () complain_no_main | ghcLink dflags == LinkInMemory = return ()
| otherwise = failWithTc noMainMsg | otherwise = failWithTc noMainMsg
...@@ -922,8 +918,9 @@ check_main dflags tcg_env ...@@ -922,8 +918,9 @@ check_main dflags tcg_env
mainCtxt = ptext (sLit "When checking the type of the") <+> pp_main_fn mainCtxt = ptext (sLit "When checking the type of the") <+> pp_main_fn
noMainMsg = ptext (sLit "The") <+> pp_main_fn noMainMsg = ptext (sLit "The") <+> pp_main_fn
<+> ptext (sLit "is not defined in module") <+> quotes (ppr main_mod) <+> ptext (sLit "is not defined in module") <+> quotes (ppr main_mod)
pp_main_fn | isJust main_is_flag = ptext (sLit "main function") <+> quotes (ppr main_fn) pp_main_fn | main_fn == main_RDR_Unqual = ptext (sLit "function") <+> quotes (ppr main_fn)
| otherwise = ptext (sLit "function") <+> quotes (ppr main_fn) | otherwise = ptext (sLit "main function") <+> quotes (ppr main_fn)
\end{code} \end{code}
Note [Root-main Id] Note [Root-main Id]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment