[Git][ghc/ghc][master] Ensure that printMinimalImports closes handle

Marge Bot gitlab at gitlab.haskell.org
Thu May 14 00:09:25 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
1c999e5d by Ben Gamari at 2020-05-13T20:09:07-04:00
Ensure that printMinimalImports closes handle

Fixes #18166.

- - - - -


1 changed file:

- compiler/GHC/Rename/Names.hs


Changes:

=====================================
compiler/GHC/Rename/Names.hs
=====================================
@@ -1619,9 +1619,8 @@ printMinimalImports imports_w_usage
   = do { imports' <- getMinimalImports imports_w_usage
        ; this_mod <- getModule
        ; dflags   <- getDynFlags
-       ; liftIO $
-         do { h <- openFile (mkFilename dflags this_mod) WriteMode
-            ; printForUser dflags h neverQualify (vcat (map ppr imports')) }
+       ; liftIO $ withFile (mkFilename dflags this_mod) WriteMode $ \h ->
+          printForUser dflags h neverQualify (vcat (map ppr imports'))
               -- The neverQualify is important.  We are printing Names
               -- but they are in the context of an 'import' decl, and
               -- we never qualify things inside there



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1c999e5d4e63e7b407b174f51913cfa38e2dec46

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1c999e5d4e63e7b407b174f51913cfa38e2dec46
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/20200513/b5276db1/attachment.html>


More information about the ghc-commits mailing list