- getSrcLocM `thenM` \ src_loc ->
- getDOpts `thenM` \ dflags ->
- case lintUnfolding dflags src_loc in_scope_vars core_expr' of
- (Nothing,_) -> returnM core_expr' -- ignore warnings
- (Just fail_msg,_) -> failWithTc ((doc <+> text "failed Lint") $$ fail_msg)
+ ifOptM Opt_DoCoreLinting (
+ getSrcLocM `thenM` \ src_loc ->
+ case lintUnfolding src_loc in_scope_vars core_expr' of
+ Nothing -> returnM ()
+ Just fail_msg -> failWithTc ((doc <+> text "Failed Lint") $$ fail_msg)
+ ) `thenM_`
+
+ returnM core_expr'