summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser/should_fail
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-07-20 11:09:03 -0700
committerDavid Terei <davidterei@gmail.com>2011-07-20 11:26:35 -0700
commit16514f272fb42af6e9c7674a9bd6c9dce369231f (patch)
treee4f332b45fe65e2a7a2451be5674f887b42bf199 /testsuite/tests/parser/should_fail
parentebd422aed41048476aa61dd4c520d43becd78682 (diff)
downloadhaskell-16514f272fb42af6e9c7674a9bd6c9dce369231f.tar.gz
Move tests from tests/ghc-regress/* to just tests/*
Diffstat (limited to 'testsuite/tests/parser/should_fail')
-rw-r--r--testsuite/tests/parser/should_fail/Makefile3
-rw-r--r--testsuite/tests/parser/should_fail/NoDoAndIfThenElse.hs9
-rw-r--r--testsuite/tests/parser/should_fail/NoDoAndIfThenElse.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/NondecreasingIndentationFail.hs10
-rw-r--r--testsuite/tests/parser/should_fail/NondecreasingIndentationFail.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/T1344a.hs7
-rw-r--r--testsuite/tests/parser/should_fail/T1344a.stderr3
-rw-r--r--testsuite/tests/parser/should_fail/T1344b.hs4
-rw-r--r--testsuite/tests/parser/should_fail/T1344b.stderr3
-rw-r--r--testsuite/tests/parser/should_fail/T1344c.hs4
-rw-r--r--testsuite/tests/parser/should_fail/T1344c.stderr3
-rw-r--r--testsuite/tests/parser/should_fail/T3095.hs5
-rw-r--r--testsuite/tests/parser/should_fail/T3095.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/T3153.hs2
-rw-r--r--testsuite/tests/parser/should_fail/T3153.stderr6
-rw-r--r--testsuite/tests/parser/should_fail/T3751.hs3
-rw-r--r--testsuite/tests/parser/should_fail/T3751.stderr3
-rw-r--r--testsuite/tests/parser/should_fail/T3811.hs5
-rw-r--r--testsuite/tests/parser/should_fail/T3811.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/T3811b.hs4
-rw-r--r--testsuite/tests/parser/should_fail/T3811b.stderr3
-rw-r--r--testsuite/tests/parser/should_fail/T3811c.hs7
-rw-r--r--testsuite/tests/parser/should_fail/T3811c.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/T3811d.hs7
-rw-r--r--testsuite/tests/parser/should_fail/T3811d.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/T3811e.hs6
-rw-r--r--testsuite/tests/parser/should_fail/T3811e.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/T3811f.hs4
-rw-r--r--testsuite/tests/parser/should_fail/T3811f.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/T3811g.hs7
-rw-r--r--testsuite/tests/parser/should_fail/T3811g.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/all.T71
-rw-r--r--testsuite/tests/parser/should_fail/position001.hs7
-rw-r--r--testsuite/tests/parser/should_fail/position001.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/position002.hs7
-rw-r--r--testsuite/tests/parser/should_fail/position002.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail001.hs113
-rw-r--r--testsuite/tests/parser/should_fail/readFail001.stderr24
-rw-r--r--testsuite/tests/parser/should_fail/readFail001.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail001.stdout87
-rw-r--r--testsuite/tests/parser/should_fail/readFail002.hs6
-rw-r--r--testsuite/tests/parser/should_fail/readFail002.stderr3
-rw-r--r--testsuite/tests/parser/should_fail/readFail002.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail003.hs8
-rw-r--r--testsuite/tests/parser/should_fail/readFail003.stderr36
-rw-r--r--testsuite/tests/parser/should_fail/readFail003.stderr-hugs5
-rw-r--r--testsuite/tests/parser/should_fail/readFail003.stdout11
-rw-r--r--testsuite/tests/parser/should_fail/readFail004.hs41
-rw-r--r--testsuite/tests/parser/should_fail/readFail004.stderr3
-rw-r--r--testsuite/tests/parser/should_fail/readFail004.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail005.hs4
-rw-r--r--testsuite/tests/parser/should_fail/readFail005.stderr3
-rw-r--r--testsuite/tests/parser/should_fail/readFail005.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail006.hs9
-rw-r--r--testsuite/tests/parser/should_fail/readFail006.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail006.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail007.hs8
-rw-r--r--testsuite/tests/parser/should_fail/readFail007.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail007.stdout9
-rw-r--r--testsuite/tests/parser/should_fail/readFail008.hs5
-rw-r--r--testsuite/tests/parser/should_fail/readFail008.stderr6
-rw-r--r--testsuite/tests/parser/should_fail/readFail008.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail009.hs15
-rw-r--r--testsuite/tests/parser/should_fail/readFail009.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail009.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail009.stdout0
-rw-r--r--testsuite/tests/parser/should_fail/readFail011.hs7
-rw-r--r--testsuite/tests/parser/should_fail/readFail011.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail011.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail012.hs9
-rw-r--r--testsuite/tests/parser/should_fail/readFail012.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail012.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail013.hs4
-rw-r--r--testsuite/tests/parser/should_fail/readFail013.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail013.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail014.hs3
-rw-r--r--testsuite/tests/parser/should_fail/readFail014.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail014.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail015.hs5
-rw-r--r--testsuite/tests/parser/should_fail/readFail015.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail015.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail016.hs7
-rw-r--r--testsuite/tests/parser/should_fail/readFail016.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/readFail016.stdout7
-rw-r--r--testsuite/tests/parser/should_fail/readFail017.hs6
-rw-r--r--testsuite/tests/parser/should_fail/readFail017.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail017.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail018.hs8
-rw-r--r--testsuite/tests/parser/should_fail/readFail018.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail018.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail019.hs3
-rw-r--r--testsuite/tests/parser/should_fail/readFail019.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail019.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail020.hs3
-rw-r--r--testsuite/tests/parser/should_fail/readFail020.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail020.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail021.hs0
-rw-r--r--testsuite/tests/parser/should_fail/readFail021.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail022.hs4
-rw-r--r--testsuite/tests/parser/should_fail/readFail022.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail022.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail023.hs12
-rw-r--r--testsuite/tests/parser/should_fail/readFail023.stderr6
-rw-r--r--testsuite/tests/parser/should_fail/readFail024.hs5
-rw-r--r--testsuite/tests/parser/should_fail/readFail024.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail024.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail025.hs5
-rw-r--r--testsuite/tests/parser/should_fail/readFail025.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/readFail025.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail026.hs3
-rw-r--r--testsuite/tests/parser/should_fail/readFail026.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail026.stderr-hugs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail027.hs15
-rw-r--r--testsuite/tests/parser/should_fail/readFail027.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail028.hs4
-rw-r--r--testsuite/tests/parser/should_fail/readFail028.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/readFail029.hs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail029.stderr6
-rw-r--r--testsuite/tests/parser/should_fail/readFail030.hs1
-rw-r--r--testsuite/tests/parser/should_fail/readFail030.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail031.hs4
-rw-r--r--testsuite/tests/parser/should_fail/readFail031.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/readFail032.hs22
-rw-r--r--testsuite/tests/parser/should_fail/readFail032.stderr8
-rw-r--r--testsuite/tests/parser/should_fail/readFail033.hs2
-rw-r--r--testsuite/tests/parser/should_fail/readFail033.stderr3
-rw-r--r--testsuite/tests/parser/should_fail/readFail034.hs5
-rw-r--r--testsuite/tests/parser/should_fail/readFail034.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail035.hs7
-rw-r--r--testsuite/tests/parser/should_fail/readFail035.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/readFail036.hs5
-rw-r--r--testsuite/tests/parser/should_fail/readFail036.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/readFail037.hs5
-rw-r--r--testsuite/tests/parser/should_fail/readFail037.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/readFail038.hs8
-rw-r--r--testsuite/tests/parser/should_fail/readFail038.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/readFail039.hs9
-rw-r--r--testsuite/tests/parser/should_fail/readFail039.stderr6
-rw-r--r--testsuite/tests/parser/should_fail/readFail040.hs9
-rw-r--r--testsuite/tests/parser/should_fail/readFail040.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail041.hs7
-rw-r--r--testsuite/tests/parser/should_fail/readFail041.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/readFail042.hs12
-rw-r--r--testsuite/tests/parser/should_fail/readFail042.stderr12
-rw-r--r--testsuite/tests/parser/should_fail/readFail043.hs14
-rw-r--r--testsuite/tests/parser/should_fail/readFail043.stderr24
-rw-r--r--testsuite/tests/parser/should_fail/readFail044.hs9
-rw-r--r--testsuite/tests/parser/should_fail/readFail044.stderr6
-rw-r--r--testsuite/tests/parser/should_fail/readFail045.stderr-ghc-7.02
-rw-r--r--testsuite/tests/parser/should_fail/readFail046.hs4
-rw-r--r--testsuite/tests/parser/should_fail/readFail046.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/readFail047.hs9
-rw-r--r--testsuite/tests/parser/should_fail/readFail047.stderr2
153 files changed, 1049 insertions, 0 deletions
diff --git a/testsuite/tests/parser/should_fail/Makefile b/testsuite/tests/parser/should_fail/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/parser/should_fail/NoDoAndIfThenElse.hs b/testsuite/tests/parser/should_fail/NoDoAndIfThenElse.hs
new file mode 100644
index 0000000000..2439205e3e
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/NoDoAndIfThenElse.hs
@@ -0,0 +1,9 @@
+
+{-# LANGUAGE NoDoAndIfThenElse #-}
+
+module NoDoAndIfThenElse where
+
+foo :: IO ()
+foo = do if True
+ then return ()
+ else return ()
diff --git a/testsuite/tests/parser/should_fail/NoDoAndIfThenElse.stderr b/testsuite/tests/parser/should_fail/NoDoAndIfThenElse.stderr
new file mode 100644
index 0000000000..b175c0ac5e
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/NoDoAndIfThenElse.stderr
@@ -0,0 +1,5 @@
+
+NoDoAndIfThenElse.hs:7:13:
+ Unexpected semi-colons in conditional:
+ if True; then return (); else return ()
+ Perhaps you meant to use -XDoAndIfThenElse?
diff --git a/testsuite/tests/parser/should_fail/NondecreasingIndentationFail.hs b/testsuite/tests/parser/should_fail/NondecreasingIndentationFail.hs
new file mode 100644
index 0000000000..5b67a60612
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/NondecreasingIndentationFail.hs
@@ -0,0 +1,10 @@
+
+{-# LANGUAGE NoNondecreasingIndentation #-}
+
+module ShouldCompile where
+
+f :: IO ()
+f = do if True then f else do
+ f
+ if True then f else do
+ f
diff --git a/testsuite/tests/parser/should_fail/NondecreasingIndentationFail.stderr b/testsuite/tests/parser/should_fail/NondecreasingIndentationFail.stderr
new file mode 100644
index 0000000000..c9ccd3ea53
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/NondecreasingIndentationFail.stderr
@@ -0,0 +1,4 @@
+
+NondecreasingIndentationFail.hs:7:28: Empty 'do' block
+
+NondecreasingIndentationFail.hs:9:28: Empty 'do' block
diff --git a/testsuite/tests/parser/should_fail/T1344a.hs b/testsuite/tests/parser/should_fail/T1344a.hs
new file mode 100644
index 0000000000..709d1636c0
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T1344a.hs
@@ -0,0 +1,7 @@
+module T1344a where
+
+a = "Hel\x6c000000000000000 World"
+b = "Hel\x6c0000000000000000 World"
+c = '\1114112'
+
+
diff --git a/testsuite/tests/parser/should_fail/T1344a.stderr b/testsuite/tests/parser/should_fail/T1344a.stderr
new file mode 100644
index 0000000000..a7c203c1c5
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T1344a.stderr
@@ -0,0 +1,3 @@
+
+T1344a.hs:3:16:
+ numeric escape sequence out of range at character '0'
diff --git a/testsuite/tests/parser/should_fail/T1344b.hs b/testsuite/tests/parser/should_fail/T1344b.hs
new file mode 100644
index 0000000000..b355dda5e6
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T1344b.hs
@@ -0,0 +1,4 @@
+module T1344b where
+
+b = "Hel\x6c0000000000000000 World"
+
diff --git a/testsuite/tests/parser/should_fail/T1344b.stderr b/testsuite/tests/parser/should_fail/T1344b.stderr
new file mode 100644
index 0000000000..7b05c0fb2b
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T1344b.stderr
@@ -0,0 +1,3 @@
+
+T1344b.hs:3:16:
+ numeric escape sequence out of range at character '0'
diff --git a/testsuite/tests/parser/should_fail/T1344c.hs b/testsuite/tests/parser/should_fail/T1344c.hs
new file mode 100644
index 0000000000..0e5d0c6190
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T1344c.hs
@@ -0,0 +1,4 @@
+module T1344c where
+
+c = '\1114112'
+
diff --git a/testsuite/tests/parser/should_fail/T1344c.stderr b/testsuite/tests/parser/should_fail/T1344c.stderr
new file mode 100644
index 0000000000..57ad0592bd
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T1344c.stderr
@@ -0,0 +1,3 @@
+
+T1344c.hs:3:13:
+ numeric escape sequence out of range at character '2'
diff --git a/testsuite/tests/parser/should_fail/T3095.hs b/testsuite/tests/parser/should_fail/T3095.hs
new file mode 100644
index 0000000000..ad6b62c562
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3095.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE KindSignatures #-}
+-- Trac #3095
+module T3095 where
+
+class Bla (forall x . x :: *) where
diff --git a/testsuite/tests/parser/should_fail/T3095.stderr b/testsuite/tests/parser/should_fail/T3095.stderr
new file mode 100644
index 0000000000..3e47128e41
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3095.stderr
@@ -0,0 +1,5 @@
+
+T3095.hs:5:21:
+ Illegal symbol '.' in type
+ Perhaps you intended -XRankNTypes or similar flag
+ to enable explicit-forall syntax: forall <tvs>. <type>
diff --git a/testsuite/tests/parser/should_fail/T3153.hs b/testsuite/tests/parser/should_fail/T3153.hs
new file mode 100644
index 0000000000..af28ddc98c
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3153.hs
@@ -0,0 +1,2 @@
+{-# LANGUAGE
+#
diff --git a/testsuite/tests/parser/should_fail/T3153.stderr b/testsuite/tests/parser/should_fail/T3153.stderr
new file mode 100644
index 0000000000..5a21b339aa
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3153.stderr
@@ -0,0 +1,6 @@
+
+T3153.hs:1:1:
+ Cannot parse LANGUAGE pragma
+ Expecting comma-separated list of language options,
+ each starting with a capital letter
+ E.g. {-# LANGUAGE RecordPuns, Generics #-}
diff --git a/testsuite/tests/parser/should_fail/T3751.hs b/testsuite/tests/parser/should_fail/T3751.hs
new file mode 100644
index 0000000000..9de569b01f
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3751.hs
@@ -0,0 +1,3 @@
+module ShouldFail where
+
+x = "\§"
diff --git a/testsuite/tests/parser/should_fail/T3751.stderr b/testsuite/tests/parser/should_fail/T3751.stderr
new file mode 100644
index 0000000000..cf14e746e1
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3751.stderr
@@ -0,0 +1,3 @@
+
+T3751.hs:3:7:
+ lexical error in string/character literal at character '\167'
diff --git a/testsuite/tests/parser/should_fail/T3811.hs b/testsuite/tests/parser/should_fail/T3811.hs
new file mode 100644
index 0000000000..30c1f5068f
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3811.hs
@@ -0,0 +1,5 @@
+
+module T3811 where
+
+f x :: Char
+f x = 'c'
diff --git a/testsuite/tests/parser/should_fail/T3811.stderr b/testsuite/tests/parser/should_fail/T3811.stderr
new file mode 100644
index 0000000000..afdead696e
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3811.stderr
@@ -0,0 +1,4 @@
+
+T3811.hs:4:1:
+ Invalid type signature: f x :: Char
+ Should be of form <variable> :: <type>
diff --git a/testsuite/tests/parser/should_fail/T3811b.hs b/testsuite/tests/parser/should_fail/T3811b.hs
new file mode 100644
index 0000000000..720cffa17f
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3811b.hs
@@ -0,0 +1,4 @@
+
+module T3811b where
+
+data Foo a = !B
diff --git a/testsuite/tests/parser/should_fail/T3811b.stderr b/testsuite/tests/parser/should_fail/T3811b.stderr
new file mode 100644
index 0000000000..342354dd84
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3811b.stderr
@@ -0,0 +1,3 @@
+
+T3811b.hs:4:14:
+ parse error in constructor in data/newtype declaration: !B
diff --git a/testsuite/tests/parser/should_fail/T3811c.hs b/testsuite/tests/parser/should_fail/T3811c.hs
new file mode 100644
index 0000000000..d2b063c54f
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3811c.hs
@@ -0,0 +1,7 @@
+
+module T3811c where
+
+data D = D
+
+instance !Show D
+
diff --git a/testsuite/tests/parser/should_fail/T3811c.stderr b/testsuite/tests/parser/should_fail/T3811c.stderr
new file mode 100644
index 0000000000..9b61341152
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3811c.stderr
@@ -0,0 +1,2 @@
+
+T3811c.hs:6:10: Malformed instance header: !Show D
diff --git a/testsuite/tests/parser/should_fail/T3811d.hs b/testsuite/tests/parser/should_fail/T3811d.hs
new file mode 100644
index 0000000000..ee95cd862d
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3811d.hs
@@ -0,0 +1,7 @@
+
+module T3811d where
+
+data D a = D a
+
+class C b (D Char) b
+
diff --git a/testsuite/tests/parser/should_fail/T3811d.stderr b/testsuite/tests/parser/should_fail/T3811d.stderr
new file mode 100644
index 0000000000..6f6e6c4267
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3811d.stderr
@@ -0,0 +1,5 @@
+
+T3811d.hs:6:11:
+ Type found: D Char
+ where type variable expected, in: b (D Char) b
+
diff --git a/testsuite/tests/parser/should_fail/T3811e.hs b/testsuite/tests/parser/should_fail/T3811e.hs
new file mode 100644
index 0000000000..69a559c9c4
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3811e.hs
@@ -0,0 +1,6 @@
+
+{-# LANGUAGE NoDatatypeContexts #-}
+
+module T3811e where
+
+data (Show a, Read a) => D a = D a
diff --git a/testsuite/tests/parser/should_fail/T3811e.stderr b/testsuite/tests/parser/should_fail/T3811e.stderr
new file mode 100644
index 0000000000..f2acc84706
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3811e.stderr
@@ -0,0 +1,5 @@
+
+T3811e.hs:6:6:
+ Illegal datatype context (use -XDatatypeContexts): (Show a,
+ Read a) =>
+
diff --git a/testsuite/tests/parser/should_fail/T3811f.hs b/testsuite/tests/parser/should_fail/T3811f.hs
new file mode 100644
index 0000000000..a047feed72
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3811f.hs
@@ -0,0 +1,4 @@
+
+module T3811f where
+
+class !Foo a
diff --git a/testsuite/tests/parser/should_fail/T3811f.stderr b/testsuite/tests/parser/should_fail/T3811f.stderr
new file mode 100644
index 0000000000..882ae06706
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3811f.stderr
@@ -0,0 +1,2 @@
+
+T3811f.hs:4:7: Malformed head of type or class declaration: !Foo a
diff --git a/testsuite/tests/parser/should_fail/T3811g.hs b/testsuite/tests/parser/should_fail/T3811g.hs
new file mode 100644
index 0000000000..8b901f49e3
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3811g.hs
@@ -0,0 +1,7 @@
+
+module T3811g where
+
+f :: IO ()
+f = do _ <- return ()
+ _ <- return ()
+
diff --git a/testsuite/tests/parser/should_fail/T3811g.stderr b/testsuite/tests/parser/should_fail/T3811g.stderr
new file mode 100644
index 0000000000..94917e52ae
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T3811g.stderr
@@ -0,0 +1,4 @@
+
+T3811g.hs:6:8:
+ The last statement in a 'do' block must be an expression
+ _ <- return ()
diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T
new file mode 100644
index 0000000000..31ec0d9a3e
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/all.T
@@ -0,0 +1,71 @@
+
+test('readFail001', normal, compile_fail, [''])
+test('readFail002', normal, compile_fail, [''])
+test('readFail003', normal, compile_fail, [''])
+test('readFail004', normal, compile_fail, [''])
+test('readFail005', normal, compile_fail, [''])
+test('readFail006', normal, compile_fail, [''])
+test('readFail007', normal, compile_fail, [''])
+test('readFail008', normal, compile_fail, [''])
+test('readFail009', normal, compile_fail, [''])
+# test10: missing
+test('readFail011', normal, compile_fail, [''])
+test('readFail012', normal, compile_fail, [''])
+test('readFail013', normal, compile_fail, [''])
+test('readFail014', normal, compile_fail, [''])
+test('readFail015', normal, compile_fail, [''])
+test('readFail016', normal, compile_fail, [''])
+test('readFail017', normal, compile_fail, [''])
+test('readFail018', normal, compile_fail, [''])
+test('readFail019', normal, compile_fail, [''])
+test('readFail020', normal, compile_fail, [''])
+
+# empty file (length zero) is not a legal Haskell module. It fails to compile
+# because it doesn't contain a definition of Main.main. GHC 5.02 crashed
+# on this example.
+test('readFail021', if_compiler_type('hugs', expect_fail), compile_fail, [''])
+
+test('readFail022', normal, compile_fail, [''])
+test('readFail023', normal, compile_fail, [''])
+test('readFail024', normal, compile_fail, [''])
+test('readFail025', normal, compile_fail, [''])
+test('readFail026', normal, compile_fail, [''])
+test('readFail027', normal, compile_fail, [''])
+test('readFail028', normal, compile_fail, [''])
+test('readFail029', normal, compile_fail, [''])
+test('readFail030', normal, compile_fail, [''])
+test('readFail031', normal, compile_fail, [''])
+test('readFail032', expect_broken(314), compile_fail, ['-cpp'])
+test('readFail033', normal, compile_fail, [''])
+test('readFail034', normal, compile_fail, [''])
+test('readFail035', normal, compile_fail, [''])
+test('readFail036', normal, compile_fail, [''])
+test('readFail037', normal, compile_fail, [''])
+test('readFail038', normal, compile_fail, [''])
+test('readFail039', normal, compile_fail, [''])
+test('readFail040', normal, compile_fail, [''])
+test('readFail041', normal, compile_fail, [''])
+test('readFail042', normal, compile_fail, [''])
+test('readFail043', normal, compile_fail, [''])
+test('readFail044', normal, compile_fail, [''])
+test('readFail046', normal, compile_fail, [''])
+test('readFail047', normal, compile_fail, [''])
+test('T3095', normal, compile_fail, [''])
+test('T3153', normal, compile_fail, [''])
+test('T3751', normal, compile_fail, [''])
+
+test('position001', normal, compile_fail, [''])
+test('position002', normal, compile_fail, [''])
+
+test('T1344a', normal, compile_fail, [''])
+test('T1344b', normal, compile_fail, [''])
+test('T1344c', normal, compile_fail, [''])
+test('T3811', normal, compile_fail, [''])
+test('T3811b', normal, compile_fail, [''])
+test('T3811c', normal, compile_fail, [''])
+test('T3811d', normal, compile_fail, [''])
+test('T3811e', normal, compile_fail, [''])
+test('T3811f', normal, compile_fail, [''])
+test('T3811g', normal, compile_fail, [''])
+test('NoDoAndIfThenElse', normal, compile_fail, [''])
+test('NondecreasingIndentationFail', normal, compile_fail, [''])
diff --git a/testsuite/tests/parser/should_fail/position001.hs b/testsuite/tests/parser/should_fail/position001.hs
new file mode 100644
index 0000000000..c47ed60a1b
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/position001.hs
@@ -0,0 +1,7 @@
+
+module T where
+
+-- We should get a parse error on column 33
+-- Indented with spaces:
+foo = 123456 module
+
diff --git a/testsuite/tests/parser/should_fail/position001.stderr b/testsuite/tests/parser/should_fail/position001.stderr
new file mode 100644
index 0000000000..0635c8d867
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/position001.stderr
@@ -0,0 +1,2 @@
+
+position001.hs:6:33: parse error on input `module'
diff --git a/testsuite/tests/parser/should_fail/position002.hs b/testsuite/tests/parser/should_fail/position002.hs
new file mode 100644
index 0000000000..861acf5344
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/position002.hs
@@ -0,0 +1,7 @@
+
+module T where
+
+-- We should get a parse error on column 33
+-- Indented with tabs:
+foo = 123456 module
+
diff --git a/testsuite/tests/parser/should_fail/position002.stderr b/testsuite/tests/parser/should_fail/position002.stderr
new file mode 100644
index 0000000000..9306d42fb8
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/position002.stderr
@@ -0,0 +1,2 @@
+
+position002.hs:6:33: parse error on input `module'
diff --git a/testsuite/tests/parser/should_fail/readFail001.hs b/testsuite/tests/parser/should_fail/readFail001.hs
new file mode 100644
index 0000000000..a996475efd
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail001.hs
@@ -0,0 +1,113 @@
+-- !!! this module supposedly includes one of each Haskell construct
+
+-- HsImpExp stuff
+
+module OneOfEverything (
+ fixn,
+ FooData,
+ FooDataB(..),
+ FooDataC( .. ),
+ Tree(Leaf, Branch),
+ EqClass(..),
+ OrdClass(orda, ordb),
+ module OneC ,
+ module OneOfEverything
+ ) where
+
+import Prelude
+import System.IO ( putStr )
+import System.Environment hiding ( getArgs )
+import Control.Monad
+
+-- HsDecls stuff
+
+infix 6 `fixn`
+infixl 7 +#
+infixr 8 `fixr`
+
+fixn x y = x
+fixl x y = x
+fixr x y = x
+
+type Pair a b = (a, b)
+
+data FooData = FooCon Int
+
+data FooDataB = FooConB Double
+
+data Tree a = Leaf a | Branch (Leaf a) (Leaf a)
+
+class (Eq a) => EqClass a where
+ eqc :: a -> Char
+ eqc x = '?'
+
+class (Ord a) => OrdClass a where
+ orda :: a -> Char
+ ordb :: a -> Char
+ ordc :: a -> Char
+
+instance (Eq a) => EqClass (Tree a) where
+ eqc x = 'a'
+
+default (Integer, Rational)
+
+-- HsBinds stuff
+
+singlebind x = x
+
+bindwith :: (OrdClass a, OrdClass b) => a -> b -> b
+bindwith a b = b
+
+reca a = recb a
+recb a = reca a
+
+(~(a,b,c)) | nullity b = a
+ | nullity c = a
+ | otherwise = a
+ where
+ nullity = null
+
+-- HsMatches stuff
+
+mat a b c d | foof a b = d
+ | foof a c = d
+ | foof b c = d
+ where
+ foof a b = a == b
+
+-- HsExpr stuff
+expr a b c d
+ = a
+ + (:) a b
+ + (a : b)
+ + (1 - 'c' - "abc" - 1.293)
+ + ( \ x y z -> x ) 42
+ + (9 *)
+ + (* 8)
+ + (case x of
+ [] | null x -> 99
+ | otherwise -> 98
+ | True -> 97
+ where
+ null x = False
+ )
+ + [ z | z <- c, isSpace z ]
+ + let y = foo
+ in y
+ + [1,2,3,4]
+ + (4,3,2,1)
+ + (4 :: Num a => a)
+ + (if 42 == 42.0 then 1 else 4)
+ + [1..]
+ + [2,4..]
+ + [3..5]
+ + [4,8..999]
+
+-- HsPat stuff
+f _ x 1 1.93 'c' "dog" ~y z@(Foo a b) (c `Bar` d) [1,2] (3,4) = y
+
+-- HsLit stuff -- done above
+
+-- HsTypes stuff
+g :: (Num a, Eq b) => Foo a -> [b] -> (a,a,a) -> b
+g x y z = head y
diff --git a/testsuite/tests/parser/should_fail/readFail001.stderr b/testsuite/tests/parser/should_fail/readFail001.stderr
new file mode 100644
index 0000000000..719d4c12bd
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail001.stderr
@@ -0,0 +1,24 @@
+
+readFail001.hs:25:11:
+ The fixity signature for `+#' lacks an accompanying binding
+
+readFail001.hs:38:32:
+ Not in scope: type constructor or class `Leaf'
+
+readFail001.hs:38:41:
+ Not in scope: type constructor or class `Leaf'
+
+readFail001.hs:87:11: Not in scope: `x'
+
+readFail001.hs:88:19: Not in scope: `x'
+
+readFail001.hs:94:19: Not in scope: `isSpace'
+
+readFail001.hs:95:13: Not in scope: `foo'
+
+readFail001.hs:107:30: Not in scope: data constructor `Foo'
+
+readFail001.hs:107:42: Not in scope: data constructor `Bar'
+
+readFail001.hs:112:23:
+ Not in scope: type constructor or class `Foo'
diff --git a/testsuite/tests/parser/should_fail/readFail001.stderr-hugs b/testsuite/tests/parser/should_fail/readFail001.stderr-hugs
new file mode 100644
index 0000000000..ab30ff6dc0
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail001.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read001.hs":38 - Undefined type constructor "EqLeaf"
diff --git a/testsuite/tests/parser/should_fail/readFail001.stdout b/testsuite/tests/parser/should_fail/readFail001.stdout
new file mode 100644
index 0000000000..a4d6758f8c
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail001.stdout
@@ -0,0 +1,87 @@
+
+==================== Parser ====================
+module OneOfEverything (
+ module OneOfEverything, module OneC, OrdClass(orda, ordb),
+ EqClass(..), EqTree(EqLeaf, EqBranch), FooDataC(..), FooDataB(..),
+ FooData, fixn
+ ) where
+import Prelude
+import IO (putStr)
+import System hiding (getArgs)
+import Monad
+bindwith :: (OrdClass a, OrdClass b) => a -> b -> b
+g :: (Num a, Eq b) => Foo a -> [b] -> (a, a, a) -> b
+g x y z = head y
+f _
+ x
+ 1
+ 1.93
+ 'c'
+ "dog"
+ ~y
+ (z@(Foo a b))
+ (c Bar d)
+ [1, 2]
+ (3, 4)
+ ((n+42))
+ = y
+expr a b c d
+ = ((((((((a + ((:) a b)) + (a : b))
+ + (((1 - 'c') - "abc") - 1.293))
+ + ((\ x y z -> x) 42))
+ + ((9 *)))
+ + ((* 8)))
+ + (case x of
+ PrelBase.[]
+ | null x -> 99
+ | otherwise -> 98
+ | True -> 97
+ where
+ null x = False))
+ + ([z | z <- c, isSpace z]))
+ + (let y = foo
+ in
+ (((((((y + [1, 2, 3, 4]) + (4, 3, 2, 1)) + (4 :: (Num a) => a))
+ + (if 42 == 42.0 then 1 else 4))
+ + ([1 .. ]))
+ + ([2, 4 .. ]))
+ + ([3 .. 5]))
+ + ([4, 8 .. 999]))
+mat a b c d
+ | foof a b = d
+ | foof a c = d
+ | foof b c = d
+ where
+ foof a b = a == b
+(~(a, b, c))
+ | nullity b = a
+ | nullity c = a
+ | otherwise = a
+ where
+ nullity = null
+recb a = reca a
+reca a = recb a
+bindwith a b = b
+singlebind x = x
+fixr x y = x
+fixl x y = x
+fixn x y = x
+infix 6 fixn
+infixl 7 +#
+infixr 8 fixr
+type Pair a b = (a, b)
+data FooData = FooCon Int
+data FooDataB = FooConB Double
+data (Eq a) => EqTree a = EqLeaf a | EqBranch (EqLeaf a) (EqLeaf a)
+class (Eq a) => EqClass a where {
+ eqc = :: a -> Char; Just eqc x = '?' }
+class (Ord a) => OrdClass a where {
+ orda = :: a -> Char; ordb = :: a -> Char; ordc = :: a -> Char;
+ Just
+ }
+instance (Eq a) => {EqClass (EqTree a)} where
+ []
+ eqc x = 'a'
+default (Integer, Rational)
+
+
diff --git a/testsuite/tests/parser/should_fail/readFail002.hs b/testsuite/tests/parser/should_fail/readFail002.hs
new file mode 100644
index 0000000000..869cb86a33
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail002.hs
@@ -0,0 +1,6 @@
+module ShouldFail where
+
+-- !!! newlines in strings aren't allowed
+
+f = "
+"
diff --git a/testsuite/tests/parser/should_fail/readFail002.stderr b/testsuite/tests/parser/should_fail/readFail002.stderr
new file mode 100644
index 0000000000..d368fe302d
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail002.stderr
@@ -0,0 +1,3 @@
+
+readFail002.hs:5:6:
+ lexical error in string/character literal at character '\n'
diff --git a/testsuite/tests/parser/should_fail/readFail002.stderr-hugs b/testsuite/tests/parser/should_fail/readFail002.stderr-hugs
new file mode 100644
index 0000000000..12031904f7
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail002.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read002.hs":5 - Improperly terminated string
diff --git a/testsuite/tests/parser/should_fail/readFail003.hs b/testsuite/tests/parser/should_fail/readFail003.hs
new file mode 100644
index 0000000000..8595312137
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail003.hs
@@ -0,0 +1,8 @@
+-- !!! Irrefutable patterns + guards
+module Read003 where
+
+~(a,b,c) | nullity b = a
+ | nullity c = a
+ | otherwise = a
+ where
+ nullity = null
diff --git a/testsuite/tests/parser/should_fail/readFail003.stderr b/testsuite/tests/parser/should_fail/readFail003.stderr
new file mode 100644
index 0000000000..fe8ce00577
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail003.stderr
@@ -0,0 +1,36 @@
+
+readFail003.hs:4:27:
+ Occurs check: cannot construct the infinite type:
+ t0 = (t0, [a0], [a1])
+ In the expression: a
+ In a pattern binding:
+ ~(a, b, c)
+ | nullity b = a
+ | nullity c = a
+ | otherwise = a
+ where
+ nullity = null
+
+readFail003.hs:5:27:
+ Occurs check: cannot construct the infinite type:
+ t0 = (t0, [a0], [a1])
+ In the expression: a
+ In a pattern binding:
+ ~(a, b, c)
+ | nullity b = a
+ | nullity c = a
+ | otherwise = a
+ where
+ nullity = null
+
+readFail003.hs:6:27:
+ Occurs check: cannot construct the infinite type:
+ t0 = (t0, [a0], [a1])
+ In the expression: a
+ In a pattern binding:
+ ~(a, b, c)
+ | nullity b = a
+ | nullity c = a
+ | otherwise = a
+ where
+ nullity = null
diff --git a/testsuite/tests/parser/should_fail/readFail003.stderr-hugs b/testsuite/tests/parser/should_fail/readFail003.stderr-hugs
new file mode 100644
index 0000000000..d89db6e928
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail003.stderr-hugs
@@ -0,0 +1,5 @@
+ERROR "read003.hs":4 - Type error in right hand side
+*** Term : a
+*** Type : a
+*** Does not match : (a,[b],[c])
+*** Because : unification would give infinite type
diff --git a/testsuite/tests/parser/should_fail/readFail003.stdout b/testsuite/tests/parser/should_fail/readFail003.stdout
new file mode 100644
index 0000000000..e1291a62a7
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail003.stdout
@@ -0,0 +1,11 @@
+
+==================== Parser ====================
+module Read003 where
+~(a, b, c)
+ | nullity b = a
+ | nullity c = a
+ | otherwise = a
+ where
+ nullity = null
+
+
diff --git a/testsuite/tests/parser/should_fail/readFail004.hs b/testsuite/tests/parser/should_fail/readFail004.hs
new file mode 100644
index 0000000000..f5e1fb4304
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail004.hs
@@ -0,0 +1,41 @@
+-- !!! string gaps
+-- !!!
+module Main(main) where
+
+-----------
+
+main = putStr "\
+
+\Some girls give me money\n\
+
+\Some girls buy me clothes\n\
+
+\..."
+
+-----------
+
+main2 = putStr "\
+\ \
+..."
+
+-----------
+
+main3 = putStr "\
+
+\Some girls give me money\n\
+-- and here is a comment
+\Some girls buy me clothes\n\
+
+\..."
+
+-----------
+
+main3 = putStr "\
+{-
+ and here is a nested {- comment -}
+-}
+\Some girls give me money\n\
+
+\Some girls buy me clothes\n\
+
+\..."
diff --git a/testsuite/tests/parser/should_fail/readFail004.stderr b/testsuite/tests/parser/should_fail/readFail004.stderr
new file mode 100644
index 0000000000..45ad7d7215
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail004.stderr
@@ -0,0 +1,3 @@
+
+readFail004.hs:19:1:
+ lexical error in string/character literal at character '.'
diff --git a/testsuite/tests/parser/should_fail/readFail004.stderr-hugs b/testsuite/tests/parser/should_fail/readFail004.stderr-hugs
new file mode 100644
index 0000000000..a737a0100e
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail004.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read004.hs":19 - Missing `\' terminating string literal gap
diff --git a/testsuite/tests/parser/should_fail/readFail005.hs b/testsuite/tests/parser/should_fail/readFail005.hs
new file mode 100644
index 0000000000..8ed88c0ea0
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail005.hs
@@ -0,0 +1,4 @@
+module Tests where
+
+-- this char is forbidden
+c = '\&'
diff --git a/testsuite/tests/parser/should_fail/readFail005.stderr b/testsuite/tests/parser/should_fail/readFail005.stderr
new file mode 100644
index 0000000000..6b5b2ce9e2
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail005.stderr
@@ -0,0 +1,3 @@
+
+readFail005.hs:4:7:
+ lexical error in string/character literal at character '&'
diff --git a/testsuite/tests/parser/should_fail/readFail005.stderr-hugs b/testsuite/tests/parser/should_fail/readFail005.stderr-hugs
new file mode 100644
index 0000000000..bda4ebcd9d
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail005.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read005.hs":4 - Illegal use of `\&' in character constant
diff --git a/testsuite/tests/parser/should_fail/readFail006.hs b/testsuite/tests/parser/should_fail/readFail006.hs
new file mode 100644
index 0000000000..fa3d867c67
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail006.hs
@@ -0,0 +1,9 @@
+-- !!! Using pattern syntax on RHS
+module ShouldFail where
+
+f :: Int -> Int
+f x = _
+
+g :: Int -> Int
+g x = 2 + 2@_
+
diff --git a/testsuite/tests/parser/should_fail/readFail006.stderr b/testsuite/tests/parser/should_fail/readFail006.stderr
new file mode 100644
index 0000000000..92ea7a484d
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail006.stderr
@@ -0,0 +1,2 @@
+
+readFail006.hs:8:12: parse error on input `@'
diff --git a/testsuite/tests/parser/should_fail/readFail006.stderr-hugs b/testsuite/tests/parser/should_fail/readFail006.stderr-hugs
new file mode 100644
index 0000000000..f39482998c
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail006.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read006.hs":8 - Syntax error in input (unexpected `@')
diff --git a/testsuite/tests/parser/should_fail/readFail007.hs b/testsuite/tests/parser/should_fail/readFail007.hs
new file mode 100644
index 0000000000..4466f17d18
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail007.hs
@@ -0,0 +1,8 @@
+-- !!! Expressions as patterns inside do stmt blocks
+module ShouldFail where
+
+f :: Int -> IO Int
+f x = do
+ (2+2) <- 2
+ return x
+
diff --git a/testsuite/tests/parser/should_fail/readFail007.stderr b/testsuite/tests/parser/should_fail/readFail007.stderr
new file mode 100644
index 0000000000..3236824a78
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail007.stderr
@@ -0,0 +1,2 @@
+
+readFail007.hs:6:4: Parse error in pattern: 2 + 2
diff --git a/testsuite/tests/parser/should_fail/readFail007.stdout b/testsuite/tests/parser/should_fail/readFail007.stdout
new file mode 100644
index 0000000000..c91365d679
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail007.stdout
@@ -0,0 +1,9 @@
+
+==================== Parser ====================
+module ShouldFail where
+f :: Int -> IO Int
+f x = do
+ (2 + 2) <- 2
+ return x
+
+
diff --git a/testsuite/tests/parser/should_fail/readFail008.hs b/testsuite/tests/parser/should_fail/readFail008.hs
new file mode 100644
index 0000000000..606af912f0
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail008.hs
@@ -0,0 +1,5 @@
+module ShouldFail where
+
+-- strictness annotations on the argument to a newtype constructor
+-- are not allowed.
+newtype N a = T ![a]
diff --git a/testsuite/tests/parser/should_fail/readFail008.stderr b/testsuite/tests/parser/should_fail/readFail008.stderr
new file mode 100644
index 0000000000..a40ce01da0
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail008.stderr
@@ -0,0 +1,6 @@
+
+readFail008.hs:5:15:
+ A newtype constructor cannot have a strictness annotation,
+ but `T' does
+ In the definition of data constructor `T'
+ In the newtype declaration for `N'
diff --git a/testsuite/tests/parser/should_fail/readFail008.stderr-hugs b/testsuite/tests/parser/should_fail/readFail008.stderr-hugs
new file mode 100644
index 0000000000..73edc248e9
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail008.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read008.hs":5 - Illegal strictness annotation for newtype constructor
diff --git a/testsuite/tests/parser/should_fail/readFail009.hs b/testsuite/tests/parser/should_fail/readFail009.hs
new file mode 100644
index 0000000000..93a7b84d5b
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail009.hs
@@ -0,0 +1,15 @@
+module ShouldFail where
+
+-- !!! Test for parse error in do/let expression
+
+foo = do let foo = True
+ return ()
+
+
+-- Note the let binding at the end!
+-- This gave a pattern-match failure in tcStmts in ghc-4.04proto
+
+h x = x
+
+
+
diff --git a/testsuite/tests/parser/should_fail/readFail009.stderr b/testsuite/tests/parser/should_fail/readFail009.stderr
new file mode 100644
index 0000000000..7f5684e2c5
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail009.stderr
@@ -0,0 +1,2 @@
+
+readFail009.hs:12:1: parse error (possibly incorrect indentation)
diff --git a/testsuite/tests/parser/should_fail/readFail009.stderr-hugs b/testsuite/tests/parser/should_fail/readFail009.stderr-hugs
new file mode 100644
index 0000000000..698df240cc
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail009.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read009.hs":12 - Syntax error in declaration (unexpected `}', possibly due to bad layout)
diff --git a/testsuite/tests/parser/should_fail/readFail009.stdout b/testsuite/tests/parser/should_fail/readFail009.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail009.stdout
diff --git a/testsuite/tests/parser/should_fail/readFail011.hs b/testsuite/tests/parser/should_fail/readFail011.hs
new file mode 100644
index 0000000000..4642061fcc
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail011.hs
@@ -0,0 +1,7 @@
+-- !!! Test line numbers in presence of string gaps.
+
+main = print "a\
+ \b\
+ \c"
+
+wibble = = -- this is a parse error on line 7
diff --git a/testsuite/tests/parser/should_fail/readFail011.stderr b/testsuite/tests/parser/should_fail/readFail011.stderr
new file mode 100644
index 0000000000..2570aa357e
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail011.stderr
@@ -0,0 +1,2 @@
+
+readFail011.hs:7:10: parse error on input `='
diff --git a/testsuite/tests/parser/should_fail/readFail011.stderr-hugs b/testsuite/tests/parser/should_fail/readFail011.stderr-hugs
new file mode 100644
index 0000000000..03d0dda838
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail011.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read011.hs":7 - Syntax error in expression (unexpected `=')
diff --git a/testsuite/tests/parser/should_fail/readFail012.hs b/testsuite/tests/parser/should_fail/readFail012.hs
new file mode 100644
index 0000000000..4a780885f7
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail012.hs
@@ -0,0 +1,9 @@
+-- !!! test parse errors due to tokens inserted by layout
+
+-- used to report "Parse error on input `'" in 4.04pl0.
+
+main = let
+ f = (a,
+ g = 1
+ in f
+
diff --git a/testsuite/tests/parser/should_fail/readFail012.stderr b/testsuite/tests/parser/should_fail/readFail012.stderr
new file mode 100644
index 0000000000..849e918204
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail012.stderr
@@ -0,0 +1,2 @@
+
+readFail012.hs:7:9: parse error (possibly incorrect indentation)
diff --git a/testsuite/tests/parser/should_fail/readFail012.stderr-hugs b/testsuite/tests/parser/should_fail/readFail012.stderr-hugs
new file mode 100644
index 0000000000..242a34ef34
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail012.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read012.hs":7 - Syntax error in expression (unexpected `;', possibly due to bad layout)
diff --git a/testsuite/tests/parser/should_fail/readFail013.hs b/testsuite/tests/parser/should_fail/readFail013.hs
new file mode 100644
index 0000000000..97e926d49c
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail013.hs
@@ -0,0 +1,4 @@
+module Main where
+
+-- !!! unterminated ``
+a = ``s``
diff --git a/testsuite/tests/parser/should_fail/readFail013.stderr b/testsuite/tests/parser/should_fail/readFail013.stderr
new file mode 100644
index 0000000000..9be590d0b0
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail013.stderr
@@ -0,0 +1,2 @@
+
+readFail013.hs:4:5: parse error on input ``'
diff --git a/testsuite/tests/parser/should_fail/readFail013.stderr-hugs b/testsuite/tests/parser/should_fail/readFail013.stderr-hugs
new file mode 100644
index 0000000000..11bb7156f5
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail013.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read013.hs":4 - Syntax error in expression (unexpected backquote)
diff --git a/testsuite/tests/parser/should_fail/readFail014.hs b/testsuite/tests/parser/should_fail/readFail014.hs
new file mode 100644
index 0000000000..23ef7954a6
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail014.hs
@@ -0,0 +1,3 @@
+main = f
+ where
+ f = f }
diff --git a/testsuite/tests/parser/should_fail/readFail014.stderr b/testsuite/tests/parser/should_fail/readFail014.stderr
new file mode 100644
index 0000000000..4bb5fff2da
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail014.stderr
@@ -0,0 +1,2 @@
+
+readFail014.hs:3:12: parse error on input `}'
diff --git a/testsuite/tests/parser/should_fail/readFail014.stderr-hugs b/testsuite/tests/parser/should_fail/readFail014.stderr-hugs
new file mode 100644
index 0000000000..73e29ecbb0
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail014.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read014.hs":3 - Misplaced `}'
diff --git a/testsuite/tests/parser/should_fail/readFail015.hs b/testsuite/tests/parser/should_fail/readFail015.hs
new file mode 100644
index 0000000000..6920083483
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail015.hs
@@ -0,0 +1,5 @@
+module Test where
+
+-- should fail; doesn't with happy 1.8.
+f = f where b = f
+ c = (b
diff --git a/testsuite/tests/parser/should_fail/readFail015.stderr b/testsuite/tests/parser/should_fail/readFail015.stderr
new file mode 100644
index 0000000000..696167edca
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail015.stderr
@@ -0,0 +1,2 @@
+
+readFail015.hs:6:1: parse error (possibly incorrect indentation)
diff --git a/testsuite/tests/parser/should_fail/readFail015.stderr-hugs b/testsuite/tests/parser/should_fail/readFail015.stderr-hugs
new file mode 100644
index 0000000000..c66b668cf5
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail015.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read015.hs":6 - Syntax error in expression (unexpected `}', possibly due to bad layout)
diff --git a/testsuite/tests/parser/should_fail/readFail016.hs b/testsuite/tests/parser/should_fail/readFail016.hs
new file mode 100644
index 0000000000..493606a481
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail016.hs
@@ -0,0 +1,7 @@
+-- !!! Infix decls w/ infix data constructors
+
+module ShouldFail where
+
+infix 6 |-
+
+ps |- q:qs = undefined
diff --git a/testsuite/tests/parser/should_fail/readFail016.stderr b/testsuite/tests/parser/should_fail/readFail016.stderr
new file mode 100644
index 0000000000..620d8505a2
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail016.stderr
@@ -0,0 +1,4 @@
+
+readFail016.hs:7:1:
+ Precedence parsing error
+ cannot mix `|-' [infix 6] and `:' [infixr 5] in the same infix expression
diff --git a/testsuite/tests/parser/should_fail/readFail016.stdout b/testsuite/tests/parser/should_fail/readFail016.stdout
new file mode 100644
index 0000000000..7c7f529466
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail016.stdout
@@ -0,0 +1,7 @@
+
+==================== Parser ====================
+module ShouldFail where
+|- ps q : qs = undefined
+infix 6 |-
+
+
diff --git a/testsuite/tests/parser/should_fail/readFail017.hs b/testsuite/tests/parser/should_fail/readFail017.hs
new file mode 100644
index 0000000000..1d710f5012
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail017.hs
@@ -0,0 +1,6 @@
+module ShouldFail where
+
+-- GHC < 5.01 used to get the line number wrong.
+f (f f) = f
+
+g = g
diff --git a/testsuite/tests/parser/should_fail/readFail017.stderr b/testsuite/tests/parser/should_fail/readFail017.stderr
new file mode 100644
index 0000000000..05f7c9931f
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail017.stderr
@@ -0,0 +1,2 @@
+
+readFail017.hs:4:4: Parse error in pattern: f
diff --git a/testsuite/tests/parser/should_fail/readFail017.stderr-hugs b/testsuite/tests/parser/should_fail/readFail017.stderr-hugs
new file mode 100644
index 0000000000..a83103a57b
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail017.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read017.hs":4 - Syntax error in declaration (unexpected symbol "f")
diff --git a/testsuite/tests/parser/should_fail/readFail018.hs b/testsuite/tests/parser/should_fail/readFail018.hs
new file mode 100644
index 0000000000..0086f50466
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail018.hs
@@ -0,0 +1,8 @@
+-- !!! test the error message for an unterminated nested comment
+
+{- <-- this one is unterminated (line 3)
+
+{-
+-}
+
+-- EOF
diff --git a/testsuite/tests/parser/should_fail/readFail018.stderr b/testsuite/tests/parser/should_fail/readFail018.stderr
new file mode 100644
index 0000000000..d07aa622c0
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail018.stderr
@@ -0,0 +1,2 @@
+
+readFail018.hs:3:1: unterminated `{-'
diff --git a/testsuite/tests/parser/should_fail/readFail018.stderr-hugs b/testsuite/tests/parser/should_fail/readFail018.stderr-hugs
new file mode 100644
index 0000000000..57c04a5826
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail018.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read018.hs":3 - Unterminated nested comment {- ...
diff --git a/testsuite/tests/parser/should_fail/readFail019.hs b/testsuite/tests/parser/should_fail/readFail019.hs
new file mode 100644
index 0000000000..c9fdd15f75
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail019.hs
@@ -0,0 +1,3 @@
+-- !!! cannot close an explicit layout context with a parse error
+module ShouldFail where
+f = let { x = 42 in x
diff --git a/testsuite/tests/parser/should_fail/readFail019.stderr b/testsuite/tests/parser/should_fail/readFail019.stderr
new file mode 100644
index 0000000000..65f7580599
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail019.stderr
@@ -0,0 +1,2 @@
+
+readFail019.hs:3:18: parse error on input `in'
diff --git a/testsuite/tests/parser/should_fail/readFail019.stderr-hugs b/testsuite/tests/parser/should_fail/readFail019.stderr-hugs
new file mode 100644
index 0000000000..fc021de327
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail019.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read019.hs":3 - Syntax error in declaration (unexpected keyword "in")
diff --git a/testsuite/tests/parser/should_fail/readFail020.hs b/testsuite/tests/parser/should_fail/readFail020.hs
new file mode 100644
index 0000000000..d7cf818e23
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail020.hs
@@ -0,0 +1,3 @@
+-- !!! cannot close a layout context with an explicit close brace
+module ShouldFail where
+f = let x = 42 } in x
diff --git a/testsuite/tests/parser/should_fail/readFail020.stderr b/testsuite/tests/parser/should_fail/readFail020.stderr
new file mode 100644
index 0000000000..fb81cef861
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail020.stderr
@@ -0,0 +1,2 @@
+
+readFail020.hs:3:16: parse error on input `}'
diff --git a/testsuite/tests/parser/should_fail/readFail020.stderr-hugs b/testsuite/tests/parser/should_fail/readFail020.stderr-hugs
new file mode 100644
index 0000000000..2fe580ec23
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail020.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read020.hs":3 - Syntax error in expression (unexpected `}', possibly due to bad layout)
diff --git a/testsuite/tests/parser/should_fail/readFail021.hs b/testsuite/tests/parser/should_fail/readFail021.hs
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail021.hs
diff --git a/testsuite/tests/parser/should_fail/readFail021.stderr b/testsuite/tests/parser/should_fail/readFail021.stderr
new file mode 100644
index 0000000000..a3f5e7b3f0
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail021.stderr
@@ -0,0 +1,2 @@
+
+readFail021.hs:1:1: The function `main' is not defined in module `Main'
diff --git a/testsuite/tests/parser/should_fail/readFail022.hs b/testsuite/tests/parser/should_fail/readFail022.hs
new file mode 100644
index 0000000000..8d63b44b40
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail022.hs
@@ -0,0 +1,4 @@
+module ShouldFail where
+
+-- !!! a parenthesised lhs must have at least one parameter
+(a # b) = a
diff --git a/testsuite/tests/parser/should_fail/readFail022.stderr b/testsuite/tests/parser/should_fail/readFail022.stderr
new file mode 100644
index 0000000000..2c1b254229
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail022.stderr
@@ -0,0 +1,2 @@
+
+readFail022.hs:4:2: Parse error in pattern: a # b
diff --git a/testsuite/tests/parser/should_fail/readFail022.stderr-hugs b/testsuite/tests/parser/should_fail/readFail022.stderr-hugs
new file mode 100644
index 0000000000..d0315f1914
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail022.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read022.hs":4 - Syntax error in declaration (unexpected `=')
diff --git a/testsuite/tests/parser/should_fail/readFail023.hs b/testsuite/tests/parser/should_fail/readFail023.hs
new file mode 100644
index 0000000000..9c230f8a6a
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail023.hs
@@ -0,0 +1,12 @@
+module ShouldFail where
+
+-- !!! Section precedences
+
+-- check that we're not translating out negative literals too early:
+-- the following should be an illegal section because prefix '-' has
+-- precedence 6:
+
+k = (-3 **)
+ where
+ (**) = const
+ infixl 7 **
diff --git a/testsuite/tests/parser/should_fail/readFail023.stderr b/testsuite/tests/parser/should_fail/readFail023.stderr
new file mode 100644
index 0000000000..e1b6ceb83c
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail023.stderr
@@ -0,0 +1,6 @@
+
+readFail023.hs:9:5:
+ The operator `**' [infixl 7] of a section
+ must have lower precedence than that of the operand,
+ namely prefix `-' [infixl 6]
+ in the section: `- 3 **'
diff --git a/testsuite/tests/parser/should_fail/readFail024.hs b/testsuite/tests/parser/should_fail/readFail024.hs
new file mode 100644
index 0000000000..70f38329ae
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail024.hs
@@ -0,0 +1,5 @@
+module ShouldFail where
+
+-- !!! this is not legal Haskell 98, but GHC parses it
+f = f where g = g where
+ h = h
diff --git a/testsuite/tests/parser/should_fail/readFail024.stderr b/testsuite/tests/parser/should_fail/readFail024.stderr
new file mode 100644
index 0000000000..01d32ec450
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail024.stderr
@@ -0,0 +1,2 @@
+
+readFail024.hs:5:2: parse error on input `h'
diff --git a/testsuite/tests/parser/should_fail/readFail024.stderr-hugs b/testsuite/tests/parser/should_fail/readFail024.stderr-hugs
new file mode 100644
index 0000000000..542507b0a6
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail024.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read024.hs":5 - Syntax error in input (unexpected symbol "h")
diff --git a/testsuite/tests/parser/should_fail/readFail025.hs b/testsuite/tests/parser/should_fail/readFail025.hs
new file mode 100644
index 0000000000..25e170d1ff
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail025.hs
@@ -0,0 +1,5 @@
+module M where
+
+-- This one actually compiled right the way up to GHC 5.04.3
+
+data T String = T String
diff --git a/testsuite/tests/parser/should_fail/readFail025.stderr b/testsuite/tests/parser/should_fail/readFail025.stderr
new file mode 100644
index 0000000000..313019147a
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail025.stderr
@@ -0,0 +1,4 @@
+
+readFail025.hs:5:8:
+ Type found: String
+ where type variable expected, in: String
diff --git a/testsuite/tests/parser/should_fail/readFail025.stderr-hugs b/testsuite/tests/parser/should_fail/readFail025.stderr-hugs
new file mode 100644
index 0000000000..176b7fd94e
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail025.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read025.hs":6 - Illegal left hand side in data type declaration
diff --git a/testsuite/tests/parser/should_fail/readFail026.hs b/testsuite/tests/parser/should_fail/readFail026.hs
new file mode 100644
index 0000000000..6d3f820151
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail026.hs
@@ -0,0 +1,3 @@
+module ShouldFail where
+data T = T{a::Int}
+x = T{,a=42}
diff --git a/testsuite/tests/parser/should_fail/readFail026.stderr b/testsuite/tests/parser/should_fail/readFail026.stderr
new file mode 100644
index 0000000000..2249fa0b41
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail026.stderr
@@ -0,0 +1,2 @@
+
+readFail026.hs:3:7: parse error on input `,'
diff --git a/testsuite/tests/parser/should_fail/readFail026.stderr-hugs b/testsuite/tests/parser/should_fail/readFail026.stderr-hugs
new file mode 100644
index 0000000000..da743251d0
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail026.stderr-hugs
@@ -0,0 +1 @@
+ERROR "read026.hs":3 - Syntax error in expression (unexpected comma)
diff --git a/testsuite/tests/parser/should_fail/readFail027.hs b/testsuite/tests/parser/should_fail/readFail027.hs
new file mode 100644
index 0000000000..9a4754678a
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail027.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE NoRelaxedLayout #-}
+
+module ShouldFail where
+
+-- Erroneously allowed by GHC 6.2.x
+f x = case x of
+ False -> do
+ { return x; }
+-- this line should close the 'case' context and cause the 'do' to be empty.
+
+-- Update: arguably this should be allowed. The fix to the Haskell
+-- layout rule to allow it is simple: in Section 9.3 in the rules that
+-- govern the introduction of the <n> and {n} psuedo-tokens, we need
+-- to prevent <n> being inserted before {. This could be a simple
+-- side-condition on the rule that introduces <n>.
diff --git a/testsuite/tests/parser/should_fail/readFail027.stderr b/testsuite/tests/parser/should_fail/readFail027.stderr
new file mode 100644
index 0000000000..68f3d25755
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail027.stderr
@@ -0,0 +1,2 @@
+
+readFail027.hs:8:5: Missing block
diff --git a/testsuite/tests/parser/should_fail/readFail028.hs b/testsuite/tests/parser/should_fail/readFail028.hs
new file mode 100644
index 0000000000..ca0d27e10e
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail028.hs
@@ -0,0 +1,4 @@
+module ShouldFail where
+
+-- !!! do must end in an expression
+main = do x <- return ()
diff --git a/testsuite/tests/parser/should_fail/readFail028.stderr b/testsuite/tests/parser/should_fail/readFail028.stderr
new file mode 100644
index 0000000000..651f778bb4
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail028.stderr
@@ -0,0 +1,4 @@
+
+readFail028.hs:4:11:
+ The last statement in a 'do' block must be an expression
+ x <- return ()
diff --git a/testsuite/tests/parser/should_fail/readFail029.hs b/testsuite/tests/parser/should_fail/readFail029.hs
new file mode 100644
index 0000000000..d107cacc17
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail029.hs
@@ -0,0 +1 @@
+{-# LANGUAGE wibble wibble wibble #-}
diff --git a/testsuite/tests/parser/should_fail/readFail029.stderr b/testsuite/tests/parser/should_fail/readFail029.stderr
new file mode 100644
index 0000000000..7f73291fe4
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail029.stderr
@@ -0,0 +1,6 @@
+
+readFail029.hs:1:14:
+ Cannot parse LANGUAGE pragma
+ Expecting comma-separated list of language options,
+ each starting with a capital letter
+ E.g. {-# LANGUAGE RecordPuns, Generics #-}
diff --git a/testsuite/tests/parser/should_fail/readFail030.hs b/testsuite/tests/parser/should_fail/readFail030.hs
new file mode 100644
index 0000000000..0829dc51ed
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail030.hs
@@ -0,0 +1 @@
+{-# LANGUAGE ExtensibleRecords, RestrictedTypeSynonyms, HereDocuments, NamedFieldPuns #-}
diff --git a/testsuite/tests/parser/should_fail/readFail030.stderr b/testsuite/tests/parser/should_fail/readFail030.stderr
new file mode 100644
index 0000000000..e557a6b055
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail030.stderr
@@ -0,0 +1,2 @@
+
+readFail030.hs:1:14: Unsupported extension: ExtensibleRecords
diff --git a/testsuite/tests/parser/should_fail/readFail031.hs b/testsuite/tests/parser/should_fail/readFail031.hs
new file mode 100644
index 0000000000..d07f8979a6
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail031.hs
@@ -0,0 +1,4 @@
+module ShouldFail where
+
+class Foo o where
+ (:+) :: o -> o -> o
diff --git a/testsuite/tests/parser/should_fail/readFail031.stderr b/testsuite/tests/parser/should_fail/readFail031.stderr
new file mode 100644
index 0000000000..628c8352f6
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail031.stderr
@@ -0,0 +1,4 @@
+
+readFail031.hs:4:3:
+ Invalid type signature: (:+) :: o -> o -> o
+ Should be of form <variable> :: <type>
diff --git a/testsuite/tests/parser/should_fail/readFail032.hs b/testsuite/tests/parser/should_fail/readFail032.hs
new file mode 100644
index 0000000000..dec758a16f
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail032.hs
@@ -0,0 +1,22 @@
+
+-- Test for trac #314
+
+{-
+/*
+ This
+ uses
+ up
+ some
+ lines
+ This
+ uses
+ up
+ some
+ lines
+ */
+-}
+
+module ShouldFail where
+
+type_error = "Type error on line 21":"Type error on line 21"
+
diff --git a/testsuite/tests/parser/should_fail/readFail032.stderr b/testsuite/tests/parser/should_fail/readFail032.stderr
new file mode 100644
index 0000000000..95852c5bbd
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail032.stderr
@@ -0,0 +1,8 @@
+
+readFail032.hs:21:38:
+ Couldn't match expected type `[Char]' with actual type `Char'
+ Expected type: [[Char]]
+ Actual type: [Char]
+ In the second argument of `(:)', namely `"Type error on line 21"'
+ In the expression:
+ "Type error on line 21" : "Type error on line 21"
diff --git a/testsuite/tests/parser/should_fail/readFail033.hs b/testsuite/tests/parser/should_fail/readFail033.hs
new file mode 100644
index 0000000000..6662563ff4
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail033.hs
@@ -0,0 +1,2 @@
+-- TAB character in a string literal is disallowed:
+x = " "
diff --git a/testsuite/tests/parser/should_fail/readFail033.stderr b/testsuite/tests/parser/should_fail/readFail033.stderr
new file mode 100644
index 0000000000..595323f3fd
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail033.stderr
@@ -0,0 +1,3 @@
+
+readFail033.hs:2:6:
+ lexical error in string/character literal at character '\t'
diff --git a/testsuite/tests/parser/should_fail/readFail034.hs b/testsuite/tests/parser/should_fail/readFail034.hs
new file mode 100644
index 0000000000..f92c33fcce
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail034.hs
@@ -0,0 +1,5 @@
+
+module Foo where
+
+foo# = 'a'
+
diff --git a/testsuite/tests/parser/should_fail/readFail034.stderr b/testsuite/tests/parser/should_fail/readFail034.stderr
new file mode 100644
index 0000000000..19f428131f
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail034.stderr
@@ -0,0 +1,2 @@
+
+readFail034.hs:4:6: parse error on input `='
diff --git a/testsuite/tests/parser/should_fail/readFail035.hs b/testsuite/tests/parser/should_fail/readFail035.hs
new file mode 100644
index 0000000000..6682e9ad8b
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail035.hs
@@ -0,0 +1,7 @@
+
+{-# LANGUAGE Haskell98 #-}
+
+module Foo where
+
+data Foo
+
diff --git a/testsuite/tests/parser/should_fail/readFail035.stderr b/testsuite/tests/parser/should_fail/readFail035.stderr
new file mode 100644
index 0000000000..05f2d864ac
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail035.stderr
@@ -0,0 +1,4 @@
+
+readFail035.hs:6:1:
+ `Foo' has no constructors (-XEmptyDataDecls permits this)
+ In the data type declaration for `Foo'
diff --git a/testsuite/tests/parser/should_fail/readFail036.hs b/testsuite/tests/parser/should_fail/readFail036.hs
new file mode 100644
index 0000000000..2bb23149dd
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail036.hs
@@ -0,0 +1,5 @@
+
+module Foo where
+
+data Foo (a :: *) = Foo a
+
diff --git a/testsuite/tests/parser/should_fail/readFail036.stderr b/testsuite/tests/parser/should_fail/readFail036.stderr
new file mode 100644
index 0000000000..8c89f29e34
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail036.stderr
@@ -0,0 +1,4 @@
+
+readFail036.hs:4:1:
+ Illegal kind signature for `a'
+ Perhaps you intended to use -XKindSignatures
diff --git a/testsuite/tests/parser/should_fail/readFail037.hs b/testsuite/tests/parser/should_fail/readFail037.hs
new file mode 100644
index 0000000000..499f5cc0f3
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail037.hs
@@ -0,0 +1,5 @@
+
+module Foo where
+
+class Foo a b
+
diff --git a/testsuite/tests/parser/should_fail/readFail037.stderr b/testsuite/tests/parser/should_fail/readFail037.stderr
new file mode 100644
index 0000000000..4c900d66b1
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail037.stderr
@@ -0,0 +1,5 @@
+
+readFail037.hs:4:1:
+ Too many parameters for class `Foo'
+ (Use -XMultiParamTypeClasses to allow multi-parameter classes)
+ In the class declaration for `Foo'
diff --git a/testsuite/tests/parser/should_fail/readFail038.hs b/testsuite/tests/parser/should_fail/readFail038.hs
new file mode 100644
index 0000000000..cc60436f2f
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail038.hs
@@ -0,0 +1,8 @@
+
+module Foo where
+
+foo = [ ()
+ | () <- foo
+ | () <- foo
+ ]
+
diff --git a/testsuite/tests/parser/should_fail/readFail038.stderr b/testsuite/tests/parser/should_fail/readFail038.stderr
new file mode 100644
index 0000000000..6933463b8f
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail038.stderr
@@ -0,0 +1,4 @@
+
+readFail038.hs:6:7:
+ Unexpected parallel statement in a list comprehension
+ Use -XParallelListComp
diff --git a/testsuite/tests/parser/should_fail/readFail039.hs b/testsuite/tests/parser/should_fail/readFail039.hs
new file mode 100644
index 0000000000..c6cbdb9968
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail039.hs
@@ -0,0 +1,9 @@
+
+module Foo where
+
+class C a
+instance C Int
+
+newtype Foo = Foo Int
+ deriving C
+
diff --git a/testsuite/tests/parser/should_fail/readFail039.stderr b/testsuite/tests/parser/should_fail/readFail039.stderr
new file mode 100644
index 0000000000..1c7cb6b975
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail039.stderr
@@ -0,0 +1,6 @@
+
+readFail039.hs:8:14:
+ Can't make a derived instance of `C Foo':
+ `C' is not a derivable class
+ Try -XGeneralizedNewtypeDeriving for GHC's newtype-deriving extension
+ In the newtype declaration for `Foo'
diff --git a/testsuite/tests/parser/should_fail/readFail040.hs b/testsuite/tests/parser/should_fail/readFail040.hs
new file mode 100644
index 0000000000..5279f166ea
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail040.hs
@@ -0,0 +1,9 @@
+
+module Foo where
+
+import Control.Monad.Fix
+
+z :: Maybe [Int]
+z = mdo x <- return (1:x)
+ return (take 4 x)
+
diff --git a/testsuite/tests/parser/should_fail/readFail040.stderr b/testsuite/tests/parser/should_fail/readFail040.stderr
new file mode 100644
index 0000000000..794899898d
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail040.stderr
@@ -0,0 +1,2 @@
+
+readFail040.hs:7:11: parse error on input `<-'
diff --git a/testsuite/tests/parser/should_fail/readFail041.hs b/testsuite/tests/parser/should_fail/readFail041.hs
new file mode 100644
index 0000000000..032e05e816
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail041.hs
@@ -0,0 +1,7 @@
+
+{-# OPTIONS_GHC -XMultiParamTypeClasses #-}
+
+module Foo where
+
+class Foo a b | a -> b
+
diff --git a/testsuite/tests/parser/should_fail/readFail041.stderr b/testsuite/tests/parser/should_fail/readFail041.stderr
new file mode 100644
index 0000000000..fbe49b1153
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail041.stderr
@@ -0,0 +1,5 @@
+
+readFail041.hs:6:1:
+ Fundeps in class `Foo'
+ (Use -XFunctionalDependencies to allow fundeps)
+ In the class declaration for `Foo'
diff --git a/testsuite/tests/parser/should_fail/readFail042.hs b/testsuite/tests/parser/should_fail/readFail042.hs
new file mode 100644
index 0000000000..bdd9f97094
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail042.hs
@@ -0,0 +1,12 @@
+-- Check error message for transforms if we don't have the right extension turned on
+
+module Foo where
+
+import Data.List
+import GHC.Exts
+
+foo = [ ()
+ | x <- [1..10]
+ , then take 5
+ , then sortWith by x
+ ] \ No newline at end of file
diff --git a/testsuite/tests/parser/should_fail/readFail042.stderr b/testsuite/tests/parser/should_fail/readFail042.stderr
new file mode 100644
index 0000000000..8fbb9bf1f7
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail042.stderr
@@ -0,0 +1,12 @@
+
+readFail042.hs:10:9:
+ Unexpected transform statement in a list comprehension
+ Use -XTransformListComp
+
+readFail042.hs:11:9:
+ Unexpected transform statement in a list comprehension
+ Use -XTransformListComp
+
+readFail042.hs:11:23: Not in scope: `by'
+
+readFail042.hs:11:26: Not in scope: `x'
diff --git a/testsuite/tests/parser/should_fail/readFail043.hs b/testsuite/tests/parser/should_fail/readFail043.hs
new file mode 100644
index 0000000000..e6304bea9a
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail043.hs
@@ -0,0 +1,14 @@
+-- Check error message for groups if we don't have the right extension turned on
+
+module Foo where
+
+import Data.List
+import GHC.Exts
+
+foo = [ ()
+ | x <- [1..10]
+ , then group by x
+ , then group by x using groupWith
+ , then group using inits
+ ]
+
diff --git a/testsuite/tests/parser/should_fail/readFail043.stderr b/testsuite/tests/parser/should_fail/readFail043.stderr
new file mode 100644
index 0000000000..1b2b1abc15
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail043.stderr
@@ -0,0 +1,24 @@
+
+readFail043.hs:10:9:
+ Unexpected transform statement in a list comprehension
+ Use -XTransformListComp
+
+readFail043.hs:10:20: Not in scope: `by'
+
+readFail043.hs:10:23: Not in scope: `x'
+
+readFail043.hs:11:9:
+ Unexpected transform statement in a list comprehension
+ Use -XTransformListComp
+
+readFail043.hs:11:20: Not in scope: `by'
+
+readFail043.hs:11:23: Not in scope: `x'
+
+readFail043.hs:11:25: Not in scope: `using'
+
+readFail043.hs:12:9:
+ Unexpected transform statement in a list comprehension
+ Use -XTransformListComp
+
+readFail043.hs:12:20: Not in scope: `using'
diff --git a/testsuite/tests/parser/should_fail/readFail044.hs b/testsuite/tests/parser/should_fail/readFail044.hs
new file mode 100644
index 0000000000..2735d3363b
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail044.hs
@@ -0,0 +1,9 @@
+
+-- We should get an error message, including a location, for these flags:
+{-# OPTIONS_GHC -this-flag-does-not-exist -nor-does-this-one #-}
+
+module Foo where
+
+foo :: ()
+foo = ()
+
diff --git a/testsuite/tests/parser/should_fail/readFail044.stderr b/testsuite/tests/parser/should_fail/readFail044.stderr
new file mode 100644
index 0000000000..27becac67c
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail044.stderr
@@ -0,0 +1,6 @@
+
+readFail044.hs:3:16:
+ unknown flag in {-# OPTIONS_GHC #-} pragma: -this-flag-does-not-exist
+
+readFail044.hs:3:16:
+ unknown flag in {-# OPTIONS_GHC #-} pragma: -nor-does-this-one
diff --git a/testsuite/tests/parser/should_fail/readFail045.stderr-ghc-7.0 b/testsuite/tests/parser/should_fail/readFail045.stderr-ghc-7.0
new file mode 100644
index 0000000000..3c25e2347c
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail045.stderr-ghc-7.0
@@ -0,0 +1,2 @@
+
+readFail045.hs:6:21: parse error on input `.+'
diff --git a/testsuite/tests/parser/should_fail/readFail046.hs b/testsuite/tests/parser/should_fail/readFail046.hs
new file mode 100644
index 0000000000..9441694dd0
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail046.hs
@@ -0,0 +1,4 @@
+{-# LANGUAGE ExistientialQuantification #-}
+-- tests for mis-spelled LANGUAGE pragma error message
+
+module ShouldFail where
diff --git a/testsuite/tests/parser/should_fail/readFail046.stderr b/testsuite/tests/parser/should_fail/readFail046.stderr
new file mode 100644
index 0000000000..a303d7798e
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail046.stderr
@@ -0,0 +1,4 @@
+
+readFail046.hs:1:14:
+ Unsupported extension: ExistientialQuantification
+ Perhaps you meant `ExistentialQuantification' or `NoExistentialQuantification'
diff --git a/testsuite/tests/parser/should_fail/readFail047.hs b/testsuite/tests/parser/should_fail/readFail047.hs
new file mode 100644
index 0000000000..5692e780fd
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail047.hs
@@ -0,0 +1,9 @@
+
+module ShouldFail where
+
+foo = let
+ x = (1, 2
+ y = 3
+ in
+ fst x + y
+
diff --git a/testsuite/tests/parser/should_fail/readFail047.stderr b/testsuite/tests/parser/should_fail/readFail047.stderr
new file mode 100644
index 0000000000..53af11cf0c
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/readFail047.stderr
@@ -0,0 +1,2 @@
+
+readFail047.hs:6:5: parse error (possibly incorrect indentation)