Skip to content

Commit b5c275f

Browse files
committed
fix: remove incorrect CPP guard around hscCheckSafeImports
Safe Haskell import checking (hscCheckSafeImports) is a compile-time feature that should work regardless of interpreter support. The previous CPP guard `#if !defined(HAVE_INTERPRETER)` caused stage1 builds (which use -interpreter flag) to skip Safe Haskell checking when compiling boot libraries. This resulted in incorrect Safe Haskell metadata in .hi files, causing testsuite failures for Safe Haskell tests (BadImport, Dep, ImpSafe, safePkg01, etc.) because ghc-internal modules compiled by stage1 had different safety inferences than expected. The fix removes the CPP guard so hscCheckSafeImports always runs, ensuring consistent Safe Haskell behavior regardless of whether the compiler has interpreter support enabled.
1 parent c1565da commit b5c275f

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

compiler/GHC/Driver/Main.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -771,11 +771,7 @@ tcRnModule' sum save_rn_syntax mod = do
771771

772772
-- module (could be) safe, throw warning if needed
773773
else do
774-
#if !defined(HAVE_INTERPRETER)
775-
let tcg_res' = tcg_res
776-
#else
777774
tcg_res' <- hscCheckSafeImports tcg_res
778-
#endif
779775
safe <- liftIO $ readIORef (tcg_safe_infer tcg_res')
780776
when safe $
781777
case wopt Opt_WarnSafe dflags of

0 commit comments

Comments
 (0)