- ; mapAndRecoverM (wrapLocM tcImpSpec)
- [L loc (name,prag) | (L loc prag@(SpecSig (L _ name) _ _)) <- prags
- , not (nameIsLocalOrFrom this_mod name) ] }
+ ; dflags <- getDOpts
+ ; if not (dopt Opt_Specialise dflags) then
+ return [] -- Ignore SPECIALISE pragmas for imported things
+ -- when -O is not on; otherwise we get bogus
+ -- complaints about lack of INLINABLE pragmas
+ -- in the imported module (also compiled without -O)
+ -- Notably, when Haddocking the base library
+ else
+ mapAndRecoverM (wrapLocM tcImpSpec)
+ [L loc (name,prag) | (L loc prag@(SpecSig (L _ name) _ _)) <- prags
+ , not (nameIsLocalOrFrom this_mod name) ] }