diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2019-02-16 03:38:21 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-02-17 20:04:33 -0500 |
commit | 1ffee940a011fc75f40514696a747dd1f3d4f342 (patch) | |
tree | 967a656c0aa5aeadc584bb457e7e5cb7c9b4e007 /testsuite | |
parent | 1f1b9e356a873ec7da84cdac2a7850ecb2b32ea9 (diff) | |
download | haskell-1ffee940a011fc75f40514696a747dd1f3d4f342.tar.gz |
Fix warnings and fatal parsing errors
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/parser/should_fail/T16270.hs | 37 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/T16270.stderr | 39 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/T16270h.hs | 13 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/T16270h.stderr | 11 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/T3095.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/T3095.stderr | 8 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/T9225.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/rnfail052.stderr | 10 |
9 files changed, 100 insertions, 27 deletions
diff --git a/testsuite/tests/parser/should_fail/T16270.hs b/testsuite/tests/parser/should_fail/T16270.hs index fa788c2eb0..0c5166d402 100644 --- a/testsuite/tests/parser/should_fail/T16270.hs +++ b/testsuite/tests/parser/should_fail/T16270.hs @@ -1,20 +1,13 @@ -{-# LANGUAGE NoTraditionalRecordSyntax, NoDoAndIfThenElse #-} - --- module T16270 (type G) where --- --- ^ Uncommenting this line prevents other errors from printing --- because HeaderInfo.getImports fails fast on parsing imports: --- --- if errorsFound dflags ms --- then throwIO $ mkSrcErr errs --- --- :( +{-# LANGUAGE NoTraditionalRecordSyntax, NoDoAndIfThenElse, NoMultiWayIf #-} +{-# OPTIONS -Werror=missing-space-after-bang #-} + +module T16270 where c = do - if c then - False - else - True + if c then + False + else + True f = id do { 1 } g = id \x -> x @@ -24,6 +17,20 @@ data Num a => D a data Pair a b = Pair { fst :: a, snd :: b } t = p { fst = 1, snd = True } +z :: forall a. () z = if True; then (); else (); data G a where + +multiWayIf !i = (a, b) + where + a = if | i -> True + | otherwise -> False + b = if | i -> False + | otherwise -> True + +-- a fatal error. +k = let + +-- not reported, as the previous one was fatal. +k = let diff --git a/testsuite/tests/parser/should_fail/T16270.stderr b/testsuite/tests/parser/should_fail/T16270.stderr index 7877a28751..7eccd9516e 100644 --- a/testsuite/tests/parser/should_fail/T16270.stderr +++ b/testsuite/tests/parser/should_fail/T16270.stderr @@ -1,38 +1,61 @@ -T16270.hs:14:6: error: +T16270.hs:7:1: warning: [-Wtabs (in -Wdefault)] + Tab character found here, and in five further locations. + Please use spaces instead. + +T16270.hs:7:12: error: Unexpected semi-colons in conditional: if c then False; else True Perhaps you meant to use DoAndIfThenElse? -T16270.hs:19:8: error: +T16270.hs:12:8: error: Unexpected do block in function application: do 1 You could write it with parentheses Or perhaps you meant to enable BlockArguments? -T16270.hs:20:8: error: +T16270.hs:13:8: error: Unexpected lambda expression in function application: \ x -> x You could write it with parentheses Or perhaps you meant to enable BlockArguments? -T16270.hs:22:6: error: +T16270.hs:15:6: error: Illegal datatype context (use DatatypeContexts): Num a => -T16270.hs:24:22: error: +T16270.hs:17:22: error: Illegal record syntax (use TraditionalRecordSyntax): {fst :: a, snd :: b} -T16270.hs:25:5: error: +T16270.hs:18:5: error: Illegal record syntax (use TraditionalRecordSyntax): p {fst = 1, snd = True} -T16270.hs:27:8: error: +T16270.hs:20:6: error: + Illegal symbol ‘forall’ in type + Perhaps you intended to use RankNTypes or a similar language + extension to enable explicit-forall syntax: forall <tvs>. <type> + +T16270.hs:21:8: error: Unexpected semi-colons in conditional: if True; then (); else () Perhaps you meant to use DoAndIfThenElse? -T16270.hs:29:10: error: +T16270.hs:23:10: error: Illegal keyword 'where' in data declaration Perhaps you intended to use GADTs or a similar language extension to enable syntax: data T where + +T16270.hs:25:12: error: [-Wmissing-space-after-bang (in -Wdefault), -Werror=missing-space-after-bang] + Did you forget to enable BangPatterns? + If you mean to bind (!) then perhaps you want + to add a space after the bang for clarity. + +T16270.hs:27:9: error: + Multi-way if-expressions need MultiWayIf turned on + +T16270.hs:29:9: error: + Multi-way if-expressions need MultiWayIf turned on + +T16270.hs:36:1: error: + parse error (possibly incorrect indentation or mismatched brackets) diff --git a/testsuite/tests/parser/should_fail/T16270h.hs b/testsuite/tests/parser/should_fail/T16270h.hs new file mode 100644 index 0000000000..c44d6edba5 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T16270h.hs @@ -0,0 +1,13 @@ +-- We can't test module header parsing errors using the same file as other +-- parsing errors (in ../T16270.hs) because HeaderInfo.getImports fails fast +-- on parsing imports: +-- +-- if errorsFound dflags ms +-- then throwIO $ mkSrcErr errs +-- +module T16270h (type G) where + +import "pkg?" M +import "pkg!" M + +data G a diff --git a/testsuite/tests/parser/should_fail/T16270h.stderr b/testsuite/tests/parser/should_fail/T16270h.stderr new file mode 100644 index 0000000000..fb7fc43a17 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T16270h.stderr @@ -0,0 +1,11 @@ + +T16270h.hs:8:22: error: + Illegal keyword 'type' (use ExplicitNamespaces to enable) + +T16270h.hs:10:8: error: + Parse error: ‘pkg?’ + Version number or non-alphanumeric character in package name + +T16270h.hs:11:8: error: + Parse error: ‘pkg!’ + Version number or non-alphanumeric character in package name diff --git a/testsuite/tests/parser/should_fail/T3095.hs b/testsuite/tests/parser/should_fail/T3095.hs index ad6b62c562..fc7889f7bf 100644 --- a/testsuite/tests/parser/should_fail/T3095.hs +++ b/testsuite/tests/parser/should_fail/T3095.hs @@ -2,4 +2,6 @@ -- Trac #3095 module T3095 where -class Bla (forall x . x :: *) where +import Data.Kind (Type) + +class Bla (forall x . x :: Type) where diff --git a/testsuite/tests/parser/should_fail/T3095.stderr b/testsuite/tests/parser/should_fail/T3095.stderr index b2b684877c..ea2ee44244 100644 --- a/testsuite/tests/parser/should_fail/T3095.stderr +++ b/testsuite/tests/parser/should_fail/T3095.stderr @@ -1,5 +1,11 @@ -T3095.hs:5:12: error: +T3095.hs:7:12: error: Illegal symbol ‘forall’ in type Perhaps you intended to use RankNTypes or a similar language extension to enable explicit-forall syntax: forall <tvs>. <type> + +T3095.hs:7:12: error: + Unexpected type ‘forall x. x :: Type’ + In the class declaration for ‘Bla’ + A class declaration should have form + class Bla a where ... diff --git a/testsuite/tests/parser/should_fail/T9225.stderr b/testsuite/tests/parser/should_fail/T9225.stderr index abbfd0ad7e..47633025b8 100644 --- a/testsuite/tests/parser/should_fail/T9225.stderr +++ b/testsuite/tests/parser/should_fail/T9225.stderr @@ -1,4 +1,4 @@ -T9225.hs:4:8: - parse error: ‘some-package-0.1.2.3’ +T9225.hs:4:8: error: + Parse error: ‘some-package-0.1.2.3’ Version number or non-alphanumeric character in package name diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T index 1a049bb2eb..aa089de3eb 100644 --- a/testsuite/tests/parser/should_fail/all.T +++ b/testsuite/tests/parser/should_fail/all.T @@ -142,3 +142,4 @@ test('unpack_empty_type', normal, compile_fail, ['']) test('unpack_inside_type', normal, compile_fail, ['']) test('unpack_before_opr', normal, compile_fail, ['']) test('T16270', normal, compile_fail, ['']) +test('T16270h', normal, compile_fail, ['']) diff --git a/testsuite/tests/rename/should_fail/rnfail052.stderr b/testsuite/tests/rename/should_fail/rnfail052.stderr index 7979dac313..b8501cfad1 100644 --- a/testsuite/tests/rename/should_fail/rnfail052.stderr +++ b/testsuite/tests/rename/should_fail/rnfail052.stderr @@ -3,3 +3,13 @@ rnfail052.hs:6:6: error: Illegal symbol ‘forall’ in type Perhaps you intended to use RankNTypes or a similar language extension to enable explicit-forall syntax: forall <tvs>. <type> + +rnfail052.hs:9:14: error: + Illegal symbol ‘forall’ in type + Perhaps you intended to use RankNTypes or a similar language + extension to enable explicit-forall syntax: forall <tvs>. <type> + +rnfail052.hs:12:15: error: + Illegal symbol ‘forall’ in type + Perhaps you intended to use RankNTypes or a similar language + extension to enable explicit-forall syntax: forall <tvs>. <type> |