[Git][ghc/ghc][wip/amg/module-cycle-error] Use structured error representation when reloading a nonexistent module

Adam Gundry (@adamgundry) gitlab at gitlab.haskell.org
Sun Jun 16 20:08:39 UTC 2024



Adam Gundry pushed to branch wip/amg/module-cycle-error at Glasgow Haskell Compiler / GHC


Commits:
407640d3 by Adam Gundry at 2024-06-16T21:07:48+01:00
Use structured error representation when reloading a nonexistent module

- - - - -


3 changed files:

- compiler/GHC/Driver/Make.hs
- testsuite/tests/ghc-e/should_fail/T18441fail5.stderr
- testsuite/tests/ghci/scripts/ghci021.stderr


Changes:

=====================================
compiler/GHC/Driver/Make.hs
=====================================
@@ -723,9 +723,9 @@ load' mhmi_cache how_much diag_wrapper mHscMessage mod_graph = do
         checkMod m and_then
             | m `Set.member` all_home_mods = and_then
             | otherwise = do
-                    liftIO $ errorMsg logger
-                        (text "no such module:" <+> quotes (ppr (moduleUnit m) <> colon <> ppr (moduleName m)))
-                    return Failed
+                    throwOneError $ mkPlainErrorMsgEnvelope noSrcSpan
+                                  $ GhcDriverMessage
+                                  $ DriverModuleNotFound (moduleName m)
 
     checkHowMuch how_much $ do
 


=====================================
testsuite/tests/ghc-e/should_fail/T18441fail5.stderr
=====================================
@@ -1,3 +1,4 @@
+<no location info>: error: [GHC-82272]
+    module ‘Abcde’ cannot be found locally
 
-<no location info>: error: no such module: ‘main:Abcde’
 1


=====================================
testsuite/tests/ghci/scripts/ghci021.stderr
=====================================
@@ -1,2 +1,3 @@
+<no location info>: error: [GHC-82272]
+    module ‘ThisDoesNotExist’ cannot be found locally
 
-<no location info>: error: no such module: ‘main:ThisDoesNotExist’



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/407640d39aba1a20bf8aebe64ec63942394ce24c

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/407640d39aba1a20bf8aebe64ec63942394ce24c
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240616/93161b14/attachment-0001.html>


More information about the ghc-commits mailing list