Generalise Package Support
[ghc-hetmet.git] / compiler / iface / LoadIface.lhs
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
3 %
4 \section{Dealing with interface files}
5
6 \begin{code}
7 module LoadIface (
8         loadInterface, loadInterfaceForName, loadWiredInHomeIface, 
9         loadSrcInterface, loadSysInterface, loadOrphanModules, 
10         findAndReadIface, readIface,    -- Used when reading the module's old interface
11         loadDecls, ifaceStats, discardDeclPrags,
12         initExternalPackageState
13    ) where
14
15 #include "HsVersions.h"
16
17 import {-# SOURCE #-}   TcIface( tcIfaceDecl, tcIfaceRule, tcIfaceInst )
18
19 import DynFlags         ( DynFlags(..), DynFlag( Opt_IgnoreInterfacePragmas ) )
20 import IfaceSyn         ( IfaceDecl(..), IfaceConDecl(..), IfaceClassOp(..),
21                           IfaceConDecls(..), IfaceIdInfo(..) )
22 import IfaceEnv         ( newGlobalBinder )
23 import HscTypes         ( ModIface(..), TyThing, emptyModIface, EpsStats(..),
24                           addEpsInStats, ExternalPackageState(..),
25                           PackageTypeEnv, emptyTypeEnv,  HscEnv(..),
26                           lookupIfaceByModule, emptyPackageIfaceTable,
27                           IsBootInterface, mkIfaceFixCache, 
28                           implicitTyThings 
29                          )
30
31 import BasicTypes       ( Version, Fixity(..), FixityDirection(..),
32                           isMarkedStrict )
33 import TcRnMonad
34
35 import PrelNames        ( gHC_PRIM )
36 import PrelInfo         ( ghcPrimExports )
37 import PrelRules        ( builtinRules )
38 import Rules            ( extendRuleBaseList, mkRuleBase )
39 import InstEnv          ( emptyInstEnv, extendInstEnvList )
40 import Name             ( Name {-instance NamedThing-}, getOccName,
41                           nameModule, nameIsLocalOrFrom, isWiredInName )
42 import NameEnv
43 import MkId             ( seqId )
44 import Module
45 import OccName          ( OccName, mkOccEnv, lookupOccEnv, mkClassTyConOcc, mkClassDataConOcc,
46                           mkSuperDictSelOcc, mkDataConWrapperOcc, mkDataConWorkerOcc )
47 import SrcLoc           ( importedSrcLoc )
48 import Maybes           ( MaybeErr(..) )
49 import ErrUtils         ( Message )
50 import Finder           ( findImportedModule, findExactModule,  
51                           FindResult(..), cantFindError )
52 import UniqFM
53 import Outputable
54 import BinIface         ( readBinIface )
55 import Panic            ( ghcError, tryMost, showException, GhcException(..) )
56 import List             ( nub )
57 \end{code}
58
59
60 %************************************************************************
61 %*                                                                      *
62         loadSrcInterface, loadOrphanModules, loadHomeInterface
63
64                 These three are called from TcM-land    
65 %*                                                                      *
66 %************************************************************************
67
68 \begin{code}
69 -- | Load the interface corresponding to an @import@ directive in 
70 -- source code.  On a failure, fail in the monad with an error message.
71 loadSrcInterface :: SDoc -> ModuleName -> IsBootInterface -> RnM ModIface
72 loadSrcInterface doc mod want_boot  = do        
73   -- We must first find which Module this import refers to.  This involves
74   -- calling the Finder, which as a side effect will search the filesystem
75   -- and create a ModLocation.  If successful, loadIface will read the
76   -- interface; it will call the Finder again, but the ModLocation will be
77   -- cached from the first search.
78   hsc_env <- getTopEnv
79   res <- ioToIOEnv $ findImportedModule hsc_env mod Nothing
80   case res of
81     Found _ mod -> do
82       mb_iface <- initIfaceTcRn $ loadInterface doc mod (ImportByUser want_boot)
83       case mb_iface of
84         Failed err      -> failWithTc (elaborate err)
85         Succeeded iface -> return iface
86     err ->
87         let dflags = hsc_dflags hsc_env in
88         failWithTc (elaborate (cantFindError dflags mod err))
89   where
90     elaborate err = hang (ptext SLIT("Failed to load interface for") <+> 
91                           quotes (ppr mod) <> colon) 4 err
92
93 -- | Load interfaces for a collection of orphan modules.
94 loadOrphanModules :: [Module] -> TcM ()
95 loadOrphanModules mods
96   | null mods = returnM ()
97   | otherwise = initIfaceTcRn $
98                 do { traceIf (text "Loading orphan modules:" <+> 
99                                  fsep (map ppr mods))
100                    ; mappM_ load mods
101                    ; returnM () }
102   where
103     load mod   = loadSysInterface (mk_doc mod) mod
104     mk_doc mod = ppr mod <+> ptext SLIT("is a orphan-instance module")
105
106 -- | Loads the interface for a given Name.
107 loadInterfaceForName :: SDoc -> Name -> TcRn ModIface
108 loadInterfaceForName doc name
109   = do  { 
110 #ifdef DEBUG
111                 -- Should not be called with a name from the module being compiled
112           this_mod <- getModule
113         ; ASSERT2( not (nameIsLocalOrFrom this_mod name), ppr name <+> parens doc )
114 #endif
115           initIfaceTcRn $ loadSysInterface doc (nameModule name)
116     }
117
118 -- | An 'IfM' function to load the home interface for a wired-in thing,
119 -- so that we're sure that we see its instance declarations and rules
120 loadWiredInHomeIface :: Name -> IfM lcl ()
121 loadWiredInHomeIface name
122   = ASSERT( isWiredInName name )
123     do loadSysInterface doc (nameModule name); return ()
124   where
125     doc = ptext SLIT("Need home interface for wired-in thing") <+> ppr name
126
127 -- | A wrapper for 'loadInterface' that throws an exception if it fails
128 loadSysInterface :: SDoc -> Module -> IfM lcl ModIface
129 loadSysInterface doc mod_name
130   = do  { mb_iface <- loadInterface doc mod_name ImportBySystem
131         ; case mb_iface of 
132             Failed err      -> ghcError (ProgramError (showSDoc err))
133             Succeeded iface -> return iface }
134 \end{code}
135
136
137 %*********************************************************
138 %*                                                      *
139                 loadInterface
140
141         The main function to load an interface
142         for an imported module, and put it in
143         the External Package State
144 %*                                                      *
145 %*********************************************************
146
147 \begin{code}
148 loadInterface :: SDoc -> Module -> WhereFrom
149               -> IfM lcl (MaybeErr Message ModIface)
150
151 -- If it can't find a suitable interface file, we
152 --      a) modify the PackageIfaceTable to have an empty entry
153 --              (to avoid repeated complaints)
154 --      b) return (Left message)
155 --
156 -- It's not necessarily an error for there not to be an interface
157 -- file -- perhaps the module has changed, and that interface 
158 -- is no longer used
159
160 loadInterface doc_str mod from
161   = do  {       -- Read the state
162           (eps,hpt) <- getEpsAndHpt
163
164         ; traceIf (text "Considering whether to load" <+> ppr mod <+> ppr from)
165
166                 -- Check whether we have the interface already
167         ; dflags <- getDOpts
168         ; case lookupIfaceByModule dflags hpt (eps_PIT eps) mod of {
169             Just iface 
170                 -> returnM (Succeeded iface) ;  -- Already loaded
171                         -- The (src_imp == mi_boot iface) test checks that the already-loaded
172                         -- interface isn't a boot iface.  This can conceivably happen,
173                         -- if an earlier import had a before we got to real imports.   I think.
174             other -> do
175
176         { let { hi_boot_file = case from of
177                                 ImportByUser usr_boot -> usr_boot
178                                 ImportBySystem        -> sys_boot
179
180               ; mb_dep   = lookupUFM (eps_is_boot eps) (moduleName mod)
181               ; sys_boot = case mb_dep of
182                                 Just (_, is_boot) -> is_boot
183                                 Nothing           -> False
184                         -- The boot-ness of the requested interface, 
185               }         -- based on the dependencies in directly-imported modules
186
187         -- READ THE MODULE IN
188         ; read_result <- findAndReadIface doc_str mod hi_boot_file
189         ; dflags <- getDOpts
190         ; case read_result of {
191             Failed err -> do
192                 { let fake_iface = emptyModIface mod
193
194                 ; updateEps_ $ \eps ->
195                         eps { eps_PIT = extendModuleEnv (eps_PIT eps) (mi_module fake_iface) fake_iface }
196                         -- Not found, so add an empty iface to 
197                         -- the EPS map so that we don't look again
198                                 
199                 ; returnM (Failed err) } ;
200
201         -- Found and parsed!
202             Succeeded (iface, file_path)                        -- Sanity check:
203                 | ImportBySystem <- from,       --   system-importing...
204                   modulePackageId (mi_module iface) == thisPackage dflags,
205                                                 --   a home-package module...
206                   Nothing <- mb_dep             --   that we know nothing about
207                 -> returnM (Failed (badDepMsg mod))
208
209                 | otherwise ->
210
211         let 
212             loc_doc = text file_path
213         in 
214         initIfaceLcl mod loc_doc $ do
215
216         --      Load the new ModIface into the External Package State
217         -- Even home-package interfaces loaded by loadInterface 
218         --      (which only happens in OneShot mode; in Batch/Interactive 
219         --      mode, home-package modules are loaded one by one into the HPT)
220         -- are put in the EPS.
221         --
222         -- The main thing is to add the ModIface to the PIT, but
223         -- we also take the
224         --      IfaceDecls, IfaceInst, IfaceRules
225         -- out of the ModIface and put them into the big EPS pools
226
227         -- NB: *first* we do loadDecl, so that the provenance of all the locally-defined
228         ---    names is done correctly (notably, whether this is an .hi file or .hi-boot file).
229         --     If we do loadExport first the wrong info gets into the cache (unless we
230         --      explicitly tag each export which seems a bit of a bore)
231
232         ; ignore_prags <- doptM Opt_IgnoreInterfacePragmas
233         ; new_eps_decls <- loadDecls ignore_prags (mi_decls iface)
234         ; new_eps_insts <- mapM tcIfaceInst (mi_insts iface)
235         ; new_eps_rules <- if ignore_prags 
236                            then return []
237                            else mapM tcIfaceRule (mi_rules iface)
238
239         ; let { final_iface = iface {   mi_decls = panic "No mi_decls in PIT",
240                                         mi_insts = panic "No mi_insts in PIT",
241                                         mi_rules = panic "No mi_rules in PIT" } }
242
243         ; updateEps_  $ \ eps -> 
244             eps { eps_PIT       = extendModuleEnv (eps_PIT eps) mod final_iface,
245                   eps_PTE       = addDeclsToPTE   (eps_PTE eps) new_eps_decls,
246                   eps_rule_base = extendRuleBaseList (eps_rule_base eps) new_eps_rules,
247                   eps_inst_env  = extendInstEnvList  (eps_inst_env eps)  new_eps_insts,
248                   eps_stats     = addEpsInStats (eps_stats eps) (length new_eps_decls)
249                                                 (length new_eps_insts) (length new_eps_rules) }
250
251         ; return (Succeeded final_iface)
252     }}}}
253
254 badDepMsg mod 
255   = hang (ptext SLIT("Interface file inconsistency:"))
256        2 (sep [ptext SLIT("home-package module") <+> quotes (ppr mod) <+> ptext SLIT("is mentioned,"), 
257                ptext SLIT("but does not appear in the dependencies of the interface")])
258
259 -----------------------------------------------------
260 --      Loading type/class/value decls
261 -- We pass the full Module name here, replete with
262 -- its package info, so that we can build a Name for
263 -- each binder with the right package info in it
264 -- All subsequent lookups, including crucially lookups during typechecking
265 -- the declaration itself, will find the fully-glorious Name
266 -----------------------------------------------------
267
268 addDeclsToPTE :: PackageTypeEnv -> [(Name,TyThing)] -> PackageTypeEnv
269 addDeclsToPTE pte things = extendNameEnvList pte things
270
271 loadDecls :: Bool
272           -> [(Version, IfaceDecl)]
273           -> IfL [(Name,TyThing)]
274 loadDecls ignore_prags ver_decls
275    = do { mod <- getIfModule
276         ; thingss <- mapM (loadDecl ignore_prags mod) ver_decls
277         ; return (concat thingss)
278         }
279
280 loadDecl :: Bool                        -- Don't load pragmas into the decl pool
281          -> Module
282           -> (Version, IfaceDecl)
283           -> IfL [(Name,TyThing)]       -- The list can be poked eagerly, but the
284                                         -- TyThings are forkM'd thunks
285 loadDecl ignore_prags mod (_version, decl)
286   = do  {       -- Populate the name cache with final versions of all 
287                 -- the names associated with the decl
288           main_name      <- mk_new_bndr mod Nothing (ifName decl)
289         ; implicit_names <- mapM (mk_new_bndr mod (Just main_name)) (ifaceDeclSubBndrs decl)
290
291         -- Typecheck the thing, lazily
292         -- NB. firstly, the laziness is there in case we never need the
293         -- declaration (in one-shot mode), and secondly it is there so that 
294         -- we don't look up the occurrence of a name before calling mk_new_bndr
295         -- on the binder.  This is important because we must get the right name
296         -- which includes its nameParent.
297         ; thing <- forkM doc (bumpDeclStats main_name >> tcIfaceDecl stripped_decl)
298         ; let mini_env = mkOccEnv [(getOccName t, t) | t <- implicitTyThings thing]
299               lookup n = case lookupOccEnv mini_env (getOccName n) of
300                            Just thing -> thing
301                            Nothing    -> pprPanic "loadDecl" (ppr main_name <+> ppr n)
302
303         ; returnM ((main_name, thing) : [(n, lookup n) | n <- implicit_names]) }
304                 -- We build a list from the *known* names, with (lookup n) thunks
305                 -- as the TyThings.  That way we can extend the PTE without poking the
306                 -- thunks
307   where
308     stripped_decl | ignore_prags = discardDeclPrags decl
309                   | otherwise    = decl
310
311         -- mk_new_bndr allocates in the name cache the final canonical
312         -- name for the thing, with the correct 
313         --      * parent
314         --      * location
315         -- imported name, to fix the module correctly in the cache
316     mk_new_bndr mod mb_parent occ 
317         = newGlobalBinder mod occ mb_parent 
318                           (importedSrcLoc (showSDoc (pprModule mod)))
319
320     doc = ptext SLIT("Declaration for") <+> ppr (ifName decl)
321
322 discardDeclPrags :: IfaceDecl -> IfaceDecl
323 discardDeclPrags decl@(IfaceId {ifIdInfo = HasInfo _}) = decl { ifIdInfo = NoInfo }
324 discardDeclPrags decl                                  = decl
325
326 bumpDeclStats :: Name -> IfL ()         -- Record that one more declaration has actually been used
327 bumpDeclStats name
328   = do  { traceIf (text "Loading decl for" <+> ppr name)
329         ; updateEps_ (\eps -> let stats = eps_stats eps
330                               in eps { eps_stats = stats { n_decls_out = n_decls_out stats + 1 } })
331         }
332
333 -----------------
334 ifaceDeclSubBndrs :: IfaceDecl -> [OccName]
335 --  *Excludes* the 'main' name, but *includes* the implicitly-bound names
336 -- Deeply revolting, because it has to predict what gets bound,
337 -- especially the question of whether there's a wrapper for a datacon
338
339 ifaceDeclSubBndrs (IfaceClass {ifCtxt = sc_ctxt, ifName = cls_occ, ifSigs = sigs })
340   = [tc_occ, dc_occ, dcww_occ] ++
341     [op | IfaceClassOp op _ _ <- sigs] ++
342     [mkSuperDictSelOcc n cls_occ | n <- [1..n_ctxt]] 
343   where
344     n_ctxt = length sc_ctxt
345     n_sigs = length sigs
346     tc_occ  = mkClassTyConOcc cls_occ
347     dc_occ  = mkClassDataConOcc cls_occ 
348     dcww_occ | is_newtype = mkDataConWrapperOcc dc_occ  -- Newtypes have wrapper but no worker
349              | otherwise  = mkDataConWorkerOcc dc_occ   -- Otherwise worker but no wrapper
350     is_newtype = n_sigs + n_ctxt == 1                   -- Sigh 
351
352 ifaceDeclSubBndrs (IfaceData {ifCons = IfAbstractTyCon}) 
353   = []
354 -- Newtype
355 ifaceDeclSubBndrs (IfaceData {ifCons = IfNewTyCon (IfVanillaCon { ifConOcc = con_occ, 
356                                                                   ifConFields = fields})}) 
357   = fields ++ [con_occ, mkDataConWrapperOcc con_occ]    
358         -- Wrapper, no worker; see MkId.mkDataConIds
359
360 ifaceDeclSubBndrs (IfaceData {ifCons = IfDataTyCon cons})
361   = nub (concatMap fld_occs cons)       -- Eliminate duplicate fields
362     ++ concatMap dc_occs cons
363   where
364     fld_occs (IfVanillaCon { ifConFields = fields }) = fields
365     fld_occs (IfGadtCon {})                          = []
366     dc_occs con_decl
367         | has_wrapper = [con_occ, work_occ, wrap_occ]
368         | otherwise   = [con_occ, work_occ]
369         where
370           con_occ = ifConOcc con_decl
371           strs    = ifConStricts con_decl
372           wrap_occ = mkDataConWrapperOcc con_occ
373           work_occ = mkDataConWorkerOcc con_occ
374           has_wrapper = any isMarkedStrict strs -- See MkId.mkDataConIds (sigh)
375                 -- ToDo: may miss strictness in existential dicts
376
377 ifaceDeclSubBndrs _other                      = []
378
379 \end{code}
380
381
382 %*********************************************************
383 %*                                                      *
384 \subsection{Reading an interface file}
385 %*                                                      *
386 %*********************************************************
387
388 \begin{code}
389 findAndReadIface :: SDoc -> Module
390                  -> IsBootInterface     -- True  <=> Look for a .hi-boot file
391                                         -- False <=> Look for .hi file
392                  -> TcRnIf gbl lcl (MaybeErr Message (ModIface, FilePath))
393         -- Nothing <=> file not found, or unreadable, or illegible
394         -- Just x  <=> successfully found and parsed 
395
396         -- It *doesn't* add an error to the monad, because 
397         -- sometimes it's ok to fail... see notes with loadInterface
398
399 findAndReadIface doc_str mod hi_boot_file
400   = do  { traceIf (sep [hsep [ptext SLIT("Reading"), 
401                               if hi_boot_file 
402                                 then ptext SLIT("[boot]") 
403                                 else empty,
404                               ptext SLIT("interface for"), 
405                               ppr mod <> semi],
406                         nest 4 (ptext SLIT("reason:") <+> doc_str)])
407
408         -- Check for GHC.Prim, and return its static interface
409         ; dflags <- getDOpts
410         ; if mod == gHC_PRIM
411           then returnM (Succeeded (ghcPrimIface, 
412                                    "<built in interface for GHC.Prim>"))
413           else do
414
415         -- Look for the file
416         ; hsc_env <- getTopEnv
417         ; mb_found <- ioToIOEnv (findHiFile hsc_env mod hi_boot_file)
418         ; case mb_found of {
419               Failed err -> do
420                 { traceIf (ptext SLIT("...not found"))
421                 ; dflags <- getDOpts
422                 ; returnM (Failed (cantFindError dflags (moduleName mod) err)) } ;
423
424               Succeeded file_path -> do 
425
426         -- Found file, so read it
427         { traceIf (ptext SLIT("readIFace") <+> text file_path)
428         ; read_result <- readIface mod file_path hi_boot_file
429         ; case read_result of
430             Failed err -> returnM (Failed (badIfaceFile file_path err))
431             Succeeded iface 
432                 | mi_module iface /= mod ->
433                   return (Failed (wrongIfaceModErr iface mod file_path))
434                 | otherwise ->
435                   returnM (Succeeded (iface, file_path))
436                         -- Don't forget to fill in the package name...
437         }}}
438
439 findHiFile :: HscEnv -> Module -> IsBootInterface
440            -> IO (MaybeErr FindResult FilePath)
441 findHiFile hsc_env mod hi_boot_file
442   = do
443       maybe_found <- findExactModule hsc_env mod
444       case maybe_found of
445         Found loc mod -> return (Succeeded path)
446                 where
447                    path = addBootSuffix_maybe hi_boot_file (ml_hi_file loc)
448         err -> return (Failed err)
449 \end{code}
450
451 @readIface@ tries just the one file.
452
453 \begin{code}
454 readIface :: Module -> FilePath -> IsBootInterface 
455           -> TcRnIf gbl lcl (MaybeErr Message ModIface)
456         -- Failed err    <=> file not found, or unreadable, or illegible
457         -- Succeeded iface <=> successfully found and parsed 
458
459 readIface wanted_mod file_path is_hi_boot_file
460   = do  { dflags <- getDOpts
461         ; ioToIOEnv $ do
462         { res <- tryMost (readBinIface file_path)
463         ; case res of
464             Right iface 
465                 | wanted_mod == actual_mod -> return (Succeeded iface)
466                 | otherwise                -> return (Failed err)
467                 where
468                   actual_mod = mi_module iface
469                   err = hiModuleNameMismatchWarn wanted_mod actual_mod
470
471             Left exn    -> return (Failed (text (showException exn)))
472     }}
473 \end{code}
474
475
476 %*********************************************************
477 %*                                                       *
478         Wired-in interface for GHC.Prim
479 %*                                                       *
480 %*********************************************************
481
482 \begin{code}
483 initExternalPackageState :: ExternalPackageState
484 initExternalPackageState
485   = EPS { 
486       eps_is_boot    = emptyUFM,
487       eps_PIT        = emptyPackageIfaceTable,
488       eps_PTE        = emptyTypeEnv,
489       eps_inst_env   = emptyInstEnv,
490       eps_rule_base  = mkRuleBase builtinRules,
491         -- Initialise the EPS rule pool with the built-in rules
492       eps_stats = EpsStats { n_ifaces_in = 0, n_decls_in = 0, n_decls_out = 0
493                            , n_insts_in = 0, n_insts_out = 0
494                            , n_rules_in = length builtinRules, n_rules_out = 0 }
495     }
496 \end{code}
497
498
499 %*********************************************************
500 %*                                                       *
501         Wired-in interface for GHC.Prim
502 %*                                                       *
503 %*********************************************************
504
505 \begin{code}
506 ghcPrimIface :: ModIface
507 ghcPrimIface
508   = (emptyModIface gHC_PRIM) {
509         mi_exports  = [(gHC_PRIM, ghcPrimExports)],
510         mi_decls    = [],
511         mi_fixities = fixities,
512         mi_fix_fn  = mkIfaceFixCache fixities
513     }           
514   where
515     fixities = [(getOccName seqId, Fixity 0 InfixR)]
516                         -- seq is infixr 0
517 \end{code}
518
519 %*********************************************************
520 %*                                                      *
521 \subsection{Statistics}
522 %*                                                      *
523 %*********************************************************
524
525 \begin{code}
526 ifaceStats :: ExternalPackageState -> SDoc
527 ifaceStats eps 
528   = hcat [text "Renamer stats: ", msg]
529   where
530     stats = eps_stats eps
531     msg = vcat 
532         [int (n_ifaces_in stats) <+> text "interfaces read",
533          hsep [ int (n_decls_out stats), text "type/class/variable imported, out of", 
534                 int (n_decls_in stats), text "read"],
535          hsep [ int (n_insts_out stats), text "instance decls imported, out of",  
536                 int (n_insts_in stats), text "read"],
537          hsep [ int (n_rules_out stats), text "rule decls imported, out of",  
538                 int (n_rules_in stats), text "read"]
539         ]
540 \end{code}    
541
542
543 %*********************************************************
544 %*                                                       *
545 \subsection{Errors}
546 %*                                                       *
547 %*********************************************************
548
549 \begin{code}
550 badIfaceFile file err
551   = vcat [ptext SLIT("Bad interface file:") <+> text file, 
552           nest 4 err]
553
554 hiModuleNameMismatchWarn :: Module -> Module -> Message
555 hiModuleNameMismatchWarn requested_mod read_mod = 
556   withPprStyle defaultUserStyle $
557     -- we want the Modules below to be qualified with package names,
558     -- so reset the PrintUnqualified setting.
559     hsep [ ptext SLIT("Something is amiss; requested module ")
560          , ppr requested_mod
561          , ptext SLIT("differs from name found in the interface file")
562          , ppr read_mod
563          ]
564
565 wrongIfaceModErr iface mod_name file_path 
566   = sep [ptext SLIT("Interface file") <+> iface_file,
567          ptext SLIT("contains module") <+> quotes (ppr (mi_module iface)) <> comma,
568          ptext SLIT("but we were expecting module") <+> quotes (ppr mod_name),
569          sep [ptext SLIT("Probable cause: the source code which generated"),
570              nest 2 iface_file,
571              ptext SLIT("has an incompatible module name")
572             ]
573         ]
574   where iface_file = doubleQuotes (text file_path)
575 \end{code}