@@ -405,6 +405,30 @@ diagnosticTests = testGroup "diagnostics"
405
405
, [(DsError , (1 , 7 ), " Cyclic module dependency between ModuleA, ModuleB" )]
406
406
)
407
407
]
408
+ , testSession' " deeply nested cyclic module dependency" $ \ path -> do
409
+ let contentA = unlines
410
+ [ " module ModuleA where" , " import ModuleB" ]
411
+ let contentB = unlines
412
+ [ " module ModuleB where" , " import ModuleA" ]
413
+ let contentC = unlines
414
+ [ " module ModuleC where" , " import ModuleB" ]
415
+ let contentD = T. unlines
416
+ [ " module ModuleD where" , " import ModuleC" ]
417
+ cradle =
418
+ " cradle: {direct: {arguments: [ModuleA, ModuleB, ModuleC, ModuleD]}}"
419
+ liftIO $ writeFile (path </> " ModuleA.hs" ) contentA
420
+ liftIO $ writeFile (path </> " ModuleB.hs" ) contentB
421
+ liftIO $ writeFile (path </> " ModuleC.hs" ) contentC
422
+ liftIO $ writeFile (path </> " hie.yaml" ) cradle
423
+ _ <- createDoc " ModuleD.hs" " haskell" contentD
424
+ expectDiagnostics
425
+ [ ( " ModuleA.hs"
426
+ , [(DsError , (1 , 7 ), " Cyclic module dependency between ModuleA, ModuleB" )]
427
+ )
428
+ , ( " ModuleB.hs"
429
+ , [(DsError , (1 , 7 ), " Cyclic module dependency between ModuleA, ModuleB" )]
430
+ )
431
+ ]
408
432
, testSessionWait " cyclic module dependency with hs-boot" $ do
409
433
let contentA = T. unlines
410
434
[ " module ModuleA where"
0 commit comments