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 /testsuite/tests/parser | |
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 'testsuite/tests/parser')
4 files changed, 13 insertions, 10 deletions
diff --git a/testsuite/tests/parser/should_fail/ParserNoForallUnicode.stderr b/testsuite/tests/parser/should_fail/ParserNoForallUnicode.stderr index 81286aa49d..0d8841c676 100644 --- a/testsuite/tests/parser/should_fail/ParserNoForallUnicode.stderr +++ b/testsuite/tests/parser/should_fail/ParserNoForallUnicode.stderr @@ -1,5 +1,6 @@ ParserNoForallUnicode.hs:6:8: error: Illegal symbol ‘∀’ in type - Perhaps you intended to use RankNTypes or a similar language - extension to enable explicit-forall syntax: ∀ <tvs>. <type> + Suggested fix: + Perhaps you intended to use RankNTypes + or a similar language extension to enable explicit-forall syntax: ∀ <tvs>. <type> diff --git a/testsuite/tests/parser/should_fail/T16270.stderr b/testsuite/tests/parser/should_fail/T16270.stderr index 578add9682..e928638539 100644 --- a/testsuite/tests/parser/should_fail/T16270.stderr +++ b/testsuite/tests/parser/should_fail/T16270.stderr @@ -37,8 +37,8 @@ T16270.hs:19:5: error: T16270.hs:21:6: error: Illegal symbol ‘forall’ in type - Perhaps you intended to use RankNTypes or a similar language - extension to enable explicit-forall syntax: forall <tvs>. <type> + Suggested fix: Perhaps you intended to use RankNTypes + or a similar language extension to enable explicit-forall syntax: forall <tvs>. <type> T16270.hs:22:8: error: Unexpected semi-colons in conditional: @@ -47,8 +47,8 @@ T16270.hs:22:8: error: T16270.hs:24:10: error: Illegal keyword 'where' in data declaration - Perhaps you intended to use GADTs or a similar language - extension to enable syntax: data T where + Suggested fix: Perhaps you intended to use GADTs + or a similar language extension to enable syntax: data T where T16270.hs:26:12: error: Illegal bang-pattern diff --git a/testsuite/tests/parser/should_fail/T3095.stderr b/testsuite/tests/parser/should_fail/T3095.stderr index 599579deb0..ebb42b5be1 100644 --- a/testsuite/tests/parser/should_fail/T3095.stderr +++ b/testsuite/tests/parser/should_fail/T3095.stderr @@ -1,8 +1,9 @@ T3095.hs:8:12: error: Illegal symbol ‘forall’ in type - Perhaps you intended to use RankNTypes or a similar language - extension to enable explicit-forall syntax: forall <tvs>. <type> + Suggested fix: + Perhaps you intended to use RankNTypes + or a similar language extension to enable explicit-forall syntax: forall <tvs>. <type> T3095.hs:8:12: error: Unexpected type ‘forall x. x :: Type’ diff --git a/testsuite/tests/parser/should_fail/T8258NoGADTs.stderr b/testsuite/tests/parser/should_fail/T8258NoGADTs.stderr index ecf3f7e11b..8e0cce6f54 100644 --- a/testsuite/tests/parser/should_fail/T8258NoGADTs.stderr +++ b/testsuite/tests/parser/should_fail/T8258NoGADTs.stderr @@ -1,5 +1,6 @@ T8258NoGADTs.hs:4:8: error: Illegal keyword 'where' in data declaration - Perhaps you intended to use GADTs or a similar language - extension to enable syntax: data T where + Suggested fix: + Perhaps you intended to use GADTs + or a similar language extension to enable syntax: data T where |