testsuite: add new test for desugar warnings/errors with -fno-code
authordoug <douglas.wilson@gmail.com>
Fri, 5 May 2017 13:18:53 +0000 (09:18 -0400)
committerBen Gamari <ben@smart-cactus.org>
Sun, 7 May 2017 16:29:06 +0000 (12:29 -0400)
Add a new (expect_broken) test T10600 that checks that the error:
Top-level bindings for unlifted types aren't allowed: is thrown when
compiling with -fno-code. This test currently fails because modules
compiled with -fno-code aren't desugared. There are several other errors
which can be thrown during desugaring that aren't tested for,
discoverable by grepping for "errDs".

Update .stderr files T8101 and T8101b. Presumably the compilation output
has changed slightly since they were written.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #10600, #8101

Differential Revision: https://phabricator.haskell.org/D3533

testsuite/tests/driver/T10600.hs [new file with mode: 0644]
testsuite/tests/driver/T10600.stderr [new file with mode: 0644]

diff --git a/testsuite/tests/driver/T10600.hs b/testsuite/tests/driver/T10600.hs
new file mode 100644 (file)
index 0000000..86b6e6c
--- /dev/null
@@ -0,0 +1,10 @@
+{-# LANGUAGE MagicHash #-}
+module T10600 where
+import GHC.Prim
+-- This shouldn't compile as unlifted bindings aren't allowed at top-level.
+-- However, #10600 described the situation where an error isn't throw when we
+-- compile with -fno-code.
+foo :: Int#
+foo = 10600#
diff --git a/testsuite/tests/driver/T10600.stderr b/testsuite/tests/driver/T10600.stderr
new file mode 100644 (file)
index 0000000..4298e67
--- /dev/null
@@ -0,0 +1,2 @@
+    Top-level bindings for unlifted types aren't allowed: foo = 10600#
\ No newline at end of file
index 6fda857..9f57360 100644 (file)
@@ -1,5 +1,4 @@
-T8101.hs:7:9: Warning:
+T8101.hs:7:9: warning: [-Wincomplete-patterns (in -Wextra)]
     Pattern match(es) are non-exhaustive
     In a case alternative:
         Patterns not matched:
index 555b036..ea8bcf0 100644 (file)
@@ -1,5 +1,6 @@
+[1 of 1] Compiling A                ( T8101b.hs, nothing )
-T8101b.hs:7:9: Warning:
+T8101b.hs:7:9: warning: [-Wincomplete-patterns (in -Wextra)]
     Pattern match(es) are non-exhaustive
     In a case alternative:
         Patterns not matched:
index 09dc79a..7971d46 100644 (file)
@@ -203,6 +203,7 @@ test('T2182', normal, run_command, ['$MAKE -s --no-print-directory T2182'])
 test('T8101', expect_broken(10600), compile, ['-Wall -fno-code'])
 test('T8101b', expect_broken(10600), multimod_compile,
      ['T8101b', '-Wall -fno-code'])
+test('T10600', expect_broken(10600), compile_fail, ['-fno-code'])
 # Should not panic when compiling cmm file together with -outputdir.
 test('T9050', cmm_src, compile, ['-outputdir=.'])