diff options
author | Alfredo Di Napoli <alfredo@well-typed.com> | 2021-07-14 08:50:22 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-07-21 02:46:13 -0400 |
commit | 06d1ca856d3374bf8dac952740cfe4cef76a350d (patch) | |
tree | b9ae2c342dca4457445b3da4dc30730043791ff3 /compiler/GHC/Tc/Errors | |
parent | 9eb1641e0ef10a7887e794d4d114c9a18a2fd265 (diff) | |
download | haskell-06d1ca856d3374bf8dac952740cfe4cef76a350d.tar.gz |
Refactor SuggestExtension constructor in GhcHint
This commit refactors the SuggestExtension type constructor of the
GhcHint to be more powerful and flexible. In particular, we can now
embed extra user information (essentially "sugar") to help clarifying
the suggestion. This makes the following possible:
Suggested fix: Perhaps you intended to use GADTs
or a similar language extension to enable syntax: data T where
We can still give to IDEs and tools a `LangExt.Extension` they can use,
but in the pretty-printed message we can tell the user a bit more on why
such extension is needed.
On top of that, we now have the ability to express conjuctions and
disjunctons, for those cases where GHC suggests to enable "X or Y" and
for the cases where we need "X and Y".
Diffstat (limited to 'compiler/GHC/Tc/Errors')
-rw-r--r-- | compiler/GHC/Tc/Errors/Ppr.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/Tc/Errors/Ppr.hs b/compiler/GHC/Tc/Errors/Ppr.hs index 97d0a40413..73ef9d9470 100644 --- a/compiler/GHC/Tc/Errors/Ppr.hs +++ b/compiler/GHC/Tc/Errors/Ppr.hs @@ -171,13 +171,13 @@ instance Diagnostic TcRnMessage where TcRnEmptyRecordUpdate{} -> noHints TcRnIllegalFieldPunning{} - -> [SuggestExtension LangExt.NamedFieldPuns] + -> [suggestExtension LangExt.NamedFieldPuns] TcRnIllegalWildcardsInRecord{} - -> [SuggestExtension LangExt.RecordWildCards] + -> [suggestExtension LangExt.RecordWildCards] TcRnDuplicateFieldName{} -> noHints TcRnIllegalViewPattern{} - -> [SuggestExtension LangExt.ViewPatterns] + -> [suggestExtension LangExt.ViewPatterns] TcRnCharLiteralOutOfRange{} -> noHints TcRnIllegalWildcardsInConstructor{} |