summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2020-10-18 18:57:40 +0300
committerVladislav Zavialov <vlad.z.4096@gmail.com>2020-10-21 16:00:30 +0300
commite2c4a94708e4d8789ce97bd8b034e62f0e8b81c6 (patch)
tree8048278aefae811256fecb7e7d995b16e41dc518
parentcf3c3bcd93b3a515f3c2db81b5a7c42af480c9b6 (diff)
downloadhaskell-e2c4a94708e4d8789ce97bd8b034e62f0e8b81c6.tar.gz
Parser regression tests, close #12862 #12446wip/parsing-tests-12446-12862
These issues were fixed by earlier parser changes, most likely related to whitespace-sensitive parsing.
-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, [''])