- | src_loc PRAGMA { \x ->
- case parseIface $2
- PState{bol = 0#, atbol = 1#,
- context = [],
- glasgow_exts = 1#,
- loc = $1 } of
- POk _ (PIdInfo id_info) -> id_info
- PFailed err ->
- pprPanic "IdInfo parse failed"
- (vcat [ppr x, err])
+ | pragma { \x -> if opt_IgnoreIfacePragmas then []
+ else case $1 of
+ POk _ id_info -> id_info
+ PFailed err -> pprPanic "IdInfo parse failed"
+ (vcat [ppr x, err])
+ }
+ {-
+ If a signature decl is being loaded, and opt_IgnoreIfacePragmas is on,
+ we toss away unfolding information.
+
+ Also, if the signature is loaded from a module we're importing from source,
+ we do the same. This is to avoid situations when compiling a pair of mutually
+ recursive modules, peering at unfolding info in the interface file of the other,
+ e.g., you compile A, it looks at B's interface file and may as a result change
+ its interface file. Hence, B is recompiled, maybe changing its interface file,
+ which will the unfolding info used in A to become invalid. Simple way out is to
+ just ignore unfolding info.
+
+ [Jan 99: I junked the second test above. If we're importing from an hi-boot
+ file there isn't going to *be* any pragma info. The above comment
+ dates from a time where we picked up a .hi file first if it existed.]
+ -}
+
+pragma :: { ParseResult [HsIdInfo RdrName] }
+pragma : src_loc PRAGMA { parseIdInfo $2 PState{ bol = 0#, atbol = 1#,
+ context = [],
+ glasgow_exts = 1#,
+ loc = $1 }