summaryrefslogtreecommitdiff
path: root/testsuite/tests/th
diff options
context:
space:
mode:
authorhainq <hai@meld.com>2021-08-28 12:50:53 +0700
committerhainq <hai@meld.com>2021-09-01 15:09:08 +0700
commitaf41496fbba4995786914f1703642c735e4a1e89 (patch)
treea91b72820a0e47dfb955af07db78e5b652e290e5 /testsuite/tests/th
parent922c6bc8dd8d089cfe4b90ec2120cb48959ba2b5 (diff)
downloadhaskell-af41496fbba4995786914f1703642c735e4a1e89.tar.gz
Convert diagnostics in GHC.Tc.Validity to proper TcRnMessage.
- Add 19 new messages. Update test outputs accordingly. - Pretty print suggest-extensions hints: remove space before interspersed commas. - Refactor Rank's MonoType constructors. Each MonoType constructor should represent a specific case. With the Doc suggestion belonging to the TcRnMessage diagnostics instead. - Move Rank from Validity to its own `GHC.Tc.Types.Rank` module. - Remove the outdated `check_irred_pred` check. - Remove the outdated duplication check in `check_valid_theta`, which was subsumed by `redundant-constraints`. - Add missing test cases for quantified-constraints/T16474 & th/T12387a.
Diffstat (limited to 'testsuite/tests/th')
-rw-r--r--testsuite/tests/th/T12387a.hs16
-rw-r--r--testsuite/tests/th/T12387a.stderr5
-rw-r--r--testsuite/tests/th/all.T1
3 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/th/T12387a.hs b/testsuite/tests/th/T12387a.hs
new file mode 100644
index 0000000000..c8ca5c942a
--- /dev/null
+++ b/testsuite/tests/th/T12387a.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeFamilies #-}
+
+module T12387a where
+
+import GHC.Generics
+import Language.Haskell.TH.Lib
+
+data Foo = Foo
+
+$(do d <- instanceD (cxt []) (conT ''Eq `appT` conT ''Foo)
+ [tySynInstD $ tySynEqn Nothing (conT ''Rep `appT` conT ''Foo) (conT ''Maybe)]
+ return [d])
+
+main :: IO ()
+main = print $ Foo == Foo
diff --git a/testsuite/tests/th/T12387a.stderr b/testsuite/tests/th/T12387a.stderr
new file mode 100644
index 0000000000..00645866d4
--- /dev/null
+++ b/testsuite/tests/th/T12387a.stderr
@@ -0,0 +1,5 @@
+
+T12387a.hs:11:2:
+ Class ‘Eq’ does not have an associated type ‘Rep’
+ In the type instance declaration for ‘Rep’
+ In the instance declaration for ‘Eq Foo’ \ No newline at end of file
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index f280ab7f57..306af0a911 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -372,6 +372,7 @@ test('T12073', normal, compile_and_run, [''])
test('T12130', [], multimod_compile,
['T12130', '-v0 ' + config.ghc_th_way_flags])
test('T12387', normal, compile_fail, ['-v0'])
+test('T12387a', normal, compile_fail, ['-v0'])
test('T12403', omit_ways(['ghci']),
compile_and_run, ['-v0 -ddump-splices -dsuppress-uniques'])
test('T12407', omit_ways(['ghci']), compile, ['-v0'])