diff options
author | Wojciech Baranowski <wbaranowski@protonmail.com> | 2019-04-13 12:31:13 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-04-29 21:02:38 -0400 |
commit | fb9408dd779f53e2d13dd18638814118f6ca0cac (patch) | |
tree | 2decc2e09e61d100a4f10c51f21fe395cc3d901c | |
parent | 2c115085982ba19985f2e00ca938370647e38e4b (diff) | |
download | haskell-fb9408dd779f53e2d13dd18638814118f6ca0cac.tar.gz |
Print suggestions in a single message
-rw-r--r-- | compiler/rename/RnEnv.hs | 12 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/readFail001.stderr | 4 |
2 files changed, 9 insertions, 7 deletions
diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs index 381ba2bfa6..7f12e05816 100644 --- a/compiler/rename/RnEnv.hs +++ b/compiler/rename/RnEnv.hs @@ -1499,11 +1499,13 @@ lookupBindGroupOcc ctxt what rdr_name candidates names_in_scope = case similar_names of - [] -> Outputable.empty - _ -> vcat $ map (\x -> text "Perhaps you meant" <+> - quotes (ppr x) <+> - parens (pprDefinedAt x)) - similar_names + [] -> Outputable.empty + [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 where similar_names = fuzzyLookup (unpackFS $ occNameFS $ rdrNameOcc rdr_name) diff --git a/testsuite/tests/parser/should_fail/readFail001.stderr b/testsuite/tests/parser/should_fail/readFail001.stderr index 0b6d4b4d29..df2b920c54 100644 --- a/testsuite/tests/parser/should_fail/readFail001.stderr +++ b/testsuite/tests/parser/should_fail/readFail001.stderr @@ -1,8 +1,8 @@ readFail001.hs:25:11: error: The fixity signature for ‘+#’ lacks an accompanying binding - Perhaps you meant ‘+’ (Defined in ‘GHC.Num’) - Perhaps you meant ‘++’ (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’ |