osa1's patch: consistent suggestion message
authorWojciech Baranowski <wbaranowski@protonmail.com>
Tue, 23 Apr 2019 08:44:57 +0000 (11:44 +0300)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Tue, 30 Apr 2019 01:02:38 +0000 (21:02 -0400)
compiler/rename/RnEnv.hs
testsuite/tests/parser/should_fail/readFail001.stderr

index 7f12e05..fe0623e 100644 (file)
@@ -1503,15 +1503,16 @@ lookupBindGroupOcc ctxt what rdr_name
           [n] -> text "Perhaps you meant" <+>
                  quotes (ppr n) <+>
                  parens (pprDefinedAt n)
-          _   -> text "Perhaps you meant one of these:" <+>
-                 pprWithCommas (\x -> quotes (ppr x) <+> parens (pprDefinedAt x))
-                               similar_names
+          _   -> sep [ text "Perhaps you meant one of these:"
+                     , nest 2 (pprWithCommas pp_item similar_names) ]
       where
         similar_names
           = fuzzyLookup (unpackFS $ occNameFS $ rdrNameOcc rdr_name)
                         $ map (\x -> ((unpackFS $ occNameFS $ nameOccName x), x))
                               names_in_scope
 
+        pp_item x = quotes (ppr x) <+> parens (pprDefinedAt x)
+
 
 ---------------
 lookupLocalTcNames :: HsSigCtxt -> SDoc -> RdrName -> RnM [(RdrName, Name)]
index df2b920..f88eaac 100644 (file)
@@ -1,8 +1,8 @@
 
 readFail001.hs:25:11: error:
     The fixity signature for ‘+#’ lacks an accompanying binding
-      Perhaps you meant one of these: ‘+’ (Defined in ‘GHC.Num’),
-                                      ‘++’ (Defined in ‘GHC.Base’)
+      Perhaps you meant one of these:
+        ‘+’ (Defined in ‘GHC.Num’), ‘++’ (Defined in ‘GHC.Base’)
 
 readFail001.hs:38:32: error:
     Not in scope: type constructor or class ‘Leaf’