projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve error reporting for type signatures
[ghc-hetmet.git]
/
compiler
/
rename
/
RnNames.lhs
diff --git
a/compiler/rename/RnNames.lhs
b/compiler/rename/RnNames.lhs
index
6c35ef1
..
253d262
100644
(file)
--- a/
compiler/rename/RnNames.lhs
+++ b/
compiler/rename/RnNames.lhs
@@
-13,7
+13,7
@@
module RnNames (
#include "HsVersions.h"
#include "HsVersions.h"
-import DynFlags ( DynFlag(..), GhcMode(..), DynFlags(..) )
+import DynFlags
import HsSyn ( IE(..), ieName, ImportDecl(..), LImportDecl,
ForeignDecl(..), HsGroup(..), HsValBinds(..),
Sig(..), collectHsBindLocatedBinders, tyClDeclNames,
import HsSyn ( IE(..), ieName, ImportDecl(..), LImportDecl,
ForeignDecl(..), HsGroup(..), HsValBinds(..),
Sig(..), collectHsBindLocatedBinders, tyClDeclNames,
@@
-708,10
+708,10
@@
rnExports explicit_mod exports
-- written "module Main where ..."
-- Reason: don't want to complain about 'main' not in scope
-- in interactive mode
-- written "module Main where ..."
-- Reason: don't want to complain about 'main' not in scope
-- in interactive mode
- ; ghc_mode <- getGhcMode
+ ; dflags <- getDOpts
; let real_exports
; let real_exports
- | explicit_mod = exports
- | ghc_mode == Interactive = Nothing
+ | explicit_mod = exports
+ | ghcLink dflags == LinkInMemory = Nothing
| otherwise = Just ([noLoc (IEVar main_RDR_Unqual)])
-- ToDo: the 'noLoc' here is unhelpful if 'main'
-- turns out to be out of scope
| otherwise = Just ([noLoc (IEVar main_RDR_Unqual)])
-- ToDo: the 'noLoc' here is unhelpful if 'main'
-- turns out to be out of scope
@@
-1307,10
+1307,12
@@
typeItemErr name wherestr
= sep [ ptext SLIT("Using 'type' tag on") <+> quotes (ppr name) <+> wherestr,
ptext SLIT("Use -findexed-types to enable this extension") ]
= sep [ ptext SLIT("Using 'type' tag on") <+> quotes (ppr name) <+> wherestr,
ptext SLIT("Use -findexed-types to enable this extension") ]
+exportClashErr :: GlobalRdrEnv -> Name -> Name -> IE RdrName -> IE RdrName
+ -> Message
exportClashErr global_env name1 name2 ie1 ie2
= vcat [ ptext SLIT("Conflicting exports for") <+> quotes (ppr occ) <> colon
exportClashErr global_env name1 name2 ie1 ie2
= vcat [ ptext SLIT("Conflicting exports for") <+> quotes (ppr occ) <> colon
- , ppr_export ie1 name1
- , ppr_export ie2 name2 ]
+ , ppr_export ie1' name1'
+ , ppr_export ie2' name2' ]
where
occ = nameOccName name1
ppr_export ie name = nest 2 (quotes (ppr ie) <+> ptext SLIT("exports") <+>
where
occ = nameOccName name1
ppr_export ie name = nest 2 (quotes (ppr ie) <+> ptext SLIT("exports") <+>
@@
-1321,6
+1323,10
@@
exportClashErr global_env name1 name2 ie1 ie2
= case lookupGRE_Name global_env name of
(gre:_) -> gre
[] -> pprPanic "exportClashErr" (ppr name)
= case lookupGRE_Name global_env name of
(gre:_) -> gre
[] -> pprPanic "exportClashErr" (ppr name)
+ get_loc name = nameSrcLoc $ gre_name $ get_gre name
+ (name1', ie1', name2', ie2') = if get_loc name1 < get_loc name2
+ then (name1, ie1, name2, ie2)
+ else (name2, ie2, name1, ie1)
addDupDeclErr :: Name -> Name -> TcRn ()
addDupDeclErr name_a name_b
addDupDeclErr :: Name -> Name -> TcRn ()
addDupDeclErr name_a name_b