[commit: ghc] master: Respect naming conventions in module RnUnbound.hs in fix for #15611 (98f8e1c)

git at git.haskell.org git at git.haskell.org
Sun Nov 11 13:30:36 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/98f8e1c2454b8c99cbb225e4a8a544288eeb082a/ghc

>---------------------------------------------------------------

commit 98f8e1c2454b8c99cbb225e4a8a544288eeb082a
Author: Roland Senn <rsx at bluewin.ch>
Date:   Sun Nov 11 11:21:26 2018 +0100

    Respect naming conventions in module RnUnbound.hs in fix for #15611
    
    Summary:
    The patch https://phabricator.haskell.org/D5284
    didn't respect the local naming conventions in module
    compiler/rename/RnUnbound.hs:
    
      - Top level functions names are written in camelCase.
      -  Local function names in where clauses are written as names_with_underscores.
    
    This patch restores these conventions.
    
    Test Plan: make test TESTS="T15611a T15611b"
    
    Reviewers: DavidEichmann, monoidal, hvr, mpickering, bgamari
    
    Reviewed By: mpickering
    
    Subscribers: rwbarton, carter
    
    GHC Trac Issues: #15611
    
    Differential Revision: https://phabricator.haskell.org/D5308


>---------------------------------------------------------------

98f8e1c2454b8c99cbb225e4a8a544288eeb082a
 compiler/rename/RnUnbound.hs | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/compiler/rename/RnUnbound.hs b/compiler/rename/RnUnbound.hs
index 97d3fd7..bf481c5 100644
--- a/compiler/rename/RnUnbound.hs
+++ b/compiler/rename/RnUnbound.hs
@@ -238,7 +238,7 @@ importSuggestions where_look hpt currMod imports rdr_name
   | not (isQual rdr_name || isUnqual rdr_name) = Outputable.empty
   | null interesting_imports
   , Just name <- mod_name
-  , showNotImportedLine (fromJust mod_name)
+  , show_not_imported_line name
   = hsep
       [ text "No module named"
       , quotes (ppr name)
@@ -341,18 +341,18 @@ importSuggestions where_look hpt currMod imports rdr_name
   (helpful_imports_hiding, helpful_imports_non_hiding)
     = partition (imv_is_hiding . snd) helpful_imports
 
-  -- See note [showNotImportedLine]
-  showNotImportedLine :: ModuleName -> Bool                           -- #15611
-  showNotImportedLine modnam
+  -- See note [When to show/hide the module-not-imported line]
+  show_not_imported_line :: ModuleName -> Bool                    -- #15611
+  show_not_imported_line modnam
       | modnam `elem`
           fmap moduleName (moduleEnvKeys (imp_mods imports)) = False   -- 1
-      | moduleName currMod == modnam       = False                     -- 2.1
-      | isLastLoadedMod modnam hptUniques  = False                     -- 2.2
-      | otherwise                          = True
+      | moduleName currMod == modnam          = False                  -- 2.1
+      | is_last_loaded_mod modnam hpt_uniques = False                  -- 2.2
+      | otherwise                             = True
     where
-      hptUniques = map fst (udfmToList hpt)
-      isLastLoadedMod _ []         = False
-      isLastLoadedMod modnam uniqs = last uniqs == getUnique modnam
+      hpt_uniques = map fst (udfmToList hpt)
+      is_last_loaded_mod _ []         = False
+      is_last_loaded_mod modnam uniqs = last uniqs == getUnique modnam
 
 extensionSuggestions :: RdrName -> SDoc
 extensionSuggestions rdrName
@@ -366,7 +366,7 @@ perhapsForallMsg
   = vcat [ text "Perhaps you intended to use ExplicitForAll or similar flag"
          , text "to enable explicit-forall syntax: forall <tvs>. <type>"]
 
-{- Note [showNotImportedLine]                                   -- #15611
+{- Note [When to show/hide the module-not-imported line]           -- #15611
 For the error message:
     Not in scope X.Y
     Module X does not export Y



More information about the ghc-commits mailing list