summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/tests/parser/should_compile/T12862.hs16
-rw-r--r--testsuite/tests/parser/should_compile/all.T1
-rw-r--r--testsuite/tests/parser/should_fail/T12446.hs3
-rw-r--r--testsuite/tests/parser/should_fail/T12446.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/all.T1
5 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/tests/parser/should_compile/T12862.hs b/testsuite/tests/parser/should_compile/T12862.hs
new file mode 100644
index 0000000000..0a9f13f471
--- /dev/null
+++ b/testsuite/tests/parser/should_compile/T12862.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE TypeFamilies, InstanceSigs #-}
+{-# LANGUAGE BangPatterns #-} -- should parse even with BangPatterns enabled
+
+module T12862 where
+
+import Data.Kind (Type)
+
+class Key key where
+ data TotalMap key :: Type -> Type
+ (!) :: TotalMap key val -> (key -> val)
+
+instance Key Bool where
+ data TotalMap Bool val = BoolMap val val
+ (!) :: TotalMap Bool val -> (Bool -> val)
+ (BoolMap f _) ! False = f -- with parentheses
+ BoolMap f _ ! True = f -- without parentheses
diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T
index f63a3f95d9..0f63299386 100644
--- a/testsuite/tests/parser/should_compile/all.T
+++ b/testsuite/tests/parser/should_compile/all.T
@@ -172,3 +172,4 @@ test('T15730a', normal, compile_and_run, [''])
test('T18130', normal, compile, [''])
test('T18834a', normal, compile, [''])
test('T18834b', normal, compile, [''])
+test('T12862', normal, compile, [''])
diff --git a/testsuite/tests/parser/should_fail/T12446.hs b/testsuite/tests/parser/should_fail/T12446.hs
new file mode 100644
index 0000000000..9f417e82da
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T12446.hs
@@ -0,0 +1,3 @@
+module T12446 where
+
+x = undefined @(_ ~ _)
diff --git a/testsuite/tests/parser/should_fail/T12446.stderr b/testsuite/tests/parser/should_fail/T12446.stderr
new file mode 100644
index 0000000000..8e51913820
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T12446.stderr
@@ -0,0 +1,4 @@
+
+T12446.hs:3:5: error:
+ Illegal visible type application ‘@(_ ~ _)’
+ Perhaps you intended to use TypeApplications
diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T
index 9142eb0393..f79c14fdc1 100644
--- a/testsuite/tests/parser/should_fail/all.T
+++ b/testsuite/tests/parser/should_fail/all.T
@@ -173,3 +173,4 @@ test('T18251c', normal, compile_fail, [''])
test('T18251d', normal, compile_fail, [''])
test('T18251e', normal, compile_fail, [''])
test('T18251f', normal, compile_fail, [''])
+test('T12446', normal, compile_fail, [''])