File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -234,10 +234,11 @@ mkTcModuleResult
234
234
-> m TcModuleResult
235
235
mkTcModuleResult tcm = do
236
236
session <- getSession
237
+ let sf = modInfoSafe (tm_checked_module_info tcm)
237
238
#if MIN_GHC_API_VERSION(8,10,0)
238
- iface <- liftIO $ mkIfaceTc session Sf_None details tcGblEnv
239
+ iface <- liftIO $ mkIfaceTc session sf details tcGblEnv
239
240
#else
240
- (iface, _) <- liftIO $ mkIfaceTc session Nothing Sf_None details tcGblEnv
241
+ (iface, _) <- liftIO $ mkIfaceTc session Nothing sf details tcGblEnv
241
242
#endif
242
243
let mod_info = HomeModInfo iface details Nothing
243
244
return $ TcModuleResult tcm mod_info
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ main = defaultMainWithRerun $ testGroup "HIE"
63
63
, pluginTests
64
64
, preprocessorTests
65
65
, thTests
66
+ , safeTests
66
67
, unitTests
67
68
, haddockTests
68
69
, positionMappingTests
@@ -1485,6 +1486,36 @@ preprocessorTests = testSessionWait "preprocessor" $ do
1485
1486
)
1486
1487
]
1487
1488
1489
+
1490
+ safeTests :: TestTree
1491
+ safeTests =
1492
+ testGroup
1493
+ " SafeHaskell"
1494
+ [ -- Test for https://github.com/digital-asset/ghcide/issues/424
1495
+ testSessionWait " load" $ do
1496
+ let sourceA =
1497
+ T. unlines
1498
+ [" {-# LANGUAGE Trustworthy #-}"
1499
+ ," module A where"
1500
+ ," import System.IO.Unsafe"
1501
+ ," import System.IO"
1502
+ ," trustWorthyId :: a -> a"
1503
+ ," trustWorthyId i = unsafePerformIO $ do"
1504
+ ," putStrLn \" I'm safe\" "
1505
+ ," return i" ]
1506
+ sourceB =
1507
+ T. unlines
1508
+ [" {-# LANGUAGE Safe #-}"
1509
+ ," module B where"
1510
+ ," import A"
1511
+ ," safeId :: a -> a"
1512
+ ," safeId = trustWorthyId"
1513
+ ]
1514
+
1515
+ _ <- openDoc' " A.hs" " haskell" sourceA
1516
+ _ <- openDoc' " B.hs" " haskell" sourceB
1517
+ expectNoMoreDiagnostics 1 ]
1518
+
1488
1519
thTests :: TestTree
1489
1520
thTests =
1490
1521
testGroup
You can’t perform that action at this time.
0 commit comments