summaryrefslogtreecommitdiff
path: root/testsuite/tests/patsyn
diff options
context:
space:
mode:
authorDr. ERDI Gergo <gergo@erdi.hu>2014-06-21 22:37:50 +0800
committerDr. ERDI Gergo <gergo@erdi.hu>2014-06-21 23:34:34 +0800
commitaa3166f42361cb605e046f4a063be3f9e1f48015 (patch)
tree1e4b791daa88cdc8d58dd7fe2b1547ab129a67d2 /testsuite/tests/patsyn
parent48abb88b20d1204dfaaf613194ab110fe43f0491 (diff)
downloadhaskell-aa3166f42361cb605e046f4a063be3f9e1f48015.tar.gz
Add fake entries into the global kind environment for pattern synonyms.
This is needed to give meaningful error messages (instead of internal panics) when a program tries to lift a pattern synonym into a kind. (fixes T9161)
Diffstat (limited to 'testsuite/tests/patsyn')
-rw-r--r--testsuite/tests/patsyn/should_fail/T9161-1.hs7
-rw-r--r--testsuite/tests/patsyn/should_fail/T9161-1.stderr4
-rw-r--r--testsuite/tests/patsyn/should_fail/T9161-2.hs9
-rw-r--r--testsuite/tests/patsyn/should_fail/T9161-2.stderr5
-rw-r--r--testsuite/tests/patsyn/should_fail/all.T2
5 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/patsyn/should_fail/T9161-1.hs b/testsuite/tests/patsyn/should_fail/T9161-1.hs
new file mode 100644
index 0000000000..c14eb542cc
--- /dev/null
+++ b/testsuite/tests/patsyn/should_fail/T9161-1.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE DataKinds #-}
+
+pattern PATTERN = ()
+
+wrongLift :: PATTERN
+wrongLift = undefined
diff --git a/testsuite/tests/patsyn/should_fail/T9161-1.stderr b/testsuite/tests/patsyn/should_fail/T9161-1.stderr
new file mode 100644
index 0000000000..1f05196ebb
--- /dev/null
+++ b/testsuite/tests/patsyn/should_fail/T9161-1.stderr
@@ -0,0 +1,4 @@
+
+T9161-1.hs:6:14:
+ Pattern synonym ‘PATTERN’ used as a type
+ In the type signature for ‘wrongLift’: wrongLift :: PATTERN
diff --git a/testsuite/tests/patsyn/should_fail/T9161-2.hs b/testsuite/tests/patsyn/should_fail/T9161-2.hs
new file mode 100644
index 0000000000..941d23e35f
--- /dev/null
+++ b/testsuite/tests/patsyn/should_fail/T9161-2.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE DataKinds, KindSignatures, PolyKinds #-}
+
+pattern PATTERN = ()
+
+data Proxy (tag :: k) (a :: *)
+
+wrongLift :: Proxy PATTERN ()
+wrongLift = undefined
diff --git a/testsuite/tests/patsyn/should_fail/T9161-2.stderr b/testsuite/tests/patsyn/should_fail/T9161-2.stderr
new file mode 100644
index 0000000000..8d21be5906
--- /dev/null
+++ b/testsuite/tests/patsyn/should_fail/T9161-2.stderr
@@ -0,0 +1,5 @@
+
+T9161-2.hs:8:20:
+ Pattern synonym ‘PATTERN’ used as a type
+ In the type signature for ‘wrongLift’:
+ wrongLift :: Proxy PATTERN ()
diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T
index 897808ef1d..bff6bdf8c2 100644
--- a/testsuite/tests/patsyn/should_fail/all.T
+++ b/testsuite/tests/patsyn/should_fail/all.T
@@ -4,3 +4,5 @@ test('unidir', normal, compile_fail, [''])
test('local', normal, compile_fail, [''])
test('T8961', normal, multimod_compile_fail, ['T8961',''])
test('as-pattern', normal, compile_fail, [''])
+test('T9161-1', normal, compile_fail, [''])
+test('T9161-2', normal, compile_fail, [''])