Skip to content
Snippets Groups Projects
Commit 169924e3 authored by Simon Marlow's avatar Simon Marlow
Browse files

[project @ 1997-10-08 12:08:14 by simonm]

Fix for special prelude names ((),[],-> etc) when compiling with
-fno-implicit-prelude.
parent b43b9385
No related merge requests found
......@@ -27,7 +27,7 @@ import RdrHsSyn
import BasicTypes ( Fixity(..), FixityDirection(..), NewOrData(..), IfaceFlavour(..) )
import PrefixToHs
import CmdLineOpts ( opt_PprUserLength )
import CmdLineOpts ( opt_PprUserLength, opt_NoImplicitPrelude )
import ErrUtils ( addErrLoc, ghcExit )
import FiniteMap ( elemFM, FiniteMap )
import Name ( OccName(..), SYN_IE(Module) )
......@@ -77,20 +77,26 @@ wlkEntId = wlkQid (\occ -> if isLexConId occ
wlkQid :: (FAST_STRING -> OccName) -> U_qid -> UgnM RdrName
-- There are three kinds of qid:
-- qualified name (noqual) A.x
-- unqualified name (aqual) x
-- qualified name (aqual) A.x
-- unqualified name (noqual) x
-- special name (gid) [], (), ->, (,,,)
-- The special names always mean "Prelude.whatever"; that's why
-- they are distinct. So if you write "()", it's just as if you
-- had written "Prelude.()". NB: The (qualified) prelude is always in scope,
-- so the renamer will find it.
-- had written "Prelude.()".
-- NB: The (qualified) prelude is always in scope, so the renamer will find it.
-- EXCEPT: when we're compiling with -fno-implicit-prelude, in which
-- case we need to unqualify these things. -- SDM.
wlkQid mk_occ_name (U_noqual name)
= returnUgn (Unqual (mk_occ_name name))
wlkQid mk_occ_name (U_aqual mod name)
= returnUgn (Qual mod (mk_occ_name name) HiFile)
wlkQid mk_occ_name (U_gid n name)
= returnUgn (Qual pRELUDE (mk_occ_name name) HiFile)
| opt_NoImplicitPrelude
= returnUgn (Unqual (mk_occ_name name))
| otherwise
= returnUgn (Qual pRELUDE (mk_occ_name name) HiFile)
rdTCId pt = rdU_qid pt `thenUgn` \ qid -> wlkTCId qid
rdVarId pt = rdU_qid pt `thenUgn` \ qid -> wlkVarId qid
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment