@@ -182,6 +182,30 @@ diagnosticTests = testGroup "diagnostics"
182182 , [(DsWarning , (2 , 0 ), " The import of 'ModuleA' is redundant" )]
183183 )
184184 ]
185+ , testSession " package imports" $ do
186+ let thisDataListContent = T. unlines
187+ [ " module Data.List where"
188+ , " x = 123"
189+ ]
190+ let mainContent = T. unlines
191+ [ " {-# LANGUAGE PackageImports #-}"
192+ , " module Main where"
193+ , " import qualified \" this\" Data.List as ThisList"
194+ , " import qualified \" base\" Data.List as BaseList"
195+ , " useThis = ThisList.x"
196+ , " useBase = BaseList.map"
197+ , " wrong1 = ThisList.map"
198+ , " wrong2 = BaseList.x"
199+ ]
200+ _ <- openDoc' " Data/List.hs" " haskell" thisDataListContent
201+ _ <- openDoc' " Main.hs" " haskell" mainContent
202+ expectDiagnostics
203+ [ ( " Main.hs"
204+ , [(DsError , (6 , 9 ), " Not in scope: \8216ThisList.map\8217" )
205+ ,(DsError , (7 , 9 ), " Not in scope: \8216BaseList.x\8217" )
206+ ]
207+ )
208+ ]
185209 ]
186210
187211codeActionTests :: TestTree
0 commit comments