From 6723c2fdf3ce39227578d8da890969dc4ea836e7 Mon Sep 17 00:00:00 2001 From: doug <douglas.wilson@gmail.com> Date: Fri, 5 May 2017 09:18:53 -0400 Subject: [PATCH] testsuite: add new test for desugar warnings/errors with -fno-code 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 (cherry picked from commit c326665c3742bb97904f7096689d40246ce6397f) --- testsuite/tests/driver/T10600.hs | 10 ++++++++++ testsuite/tests/driver/T10600.stderr | 2 ++ testsuite/tests/driver/T8101.stderr | 3 +-- testsuite/tests/driver/T8101b.stderr | 3 ++- testsuite/tests/driver/all.T | 1 + 5 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 testsuite/tests/driver/T10600.hs create mode 100644 testsuite/tests/driver/T10600.stderr diff --git a/testsuite/tests/driver/T10600.hs b/testsuite/tests/driver/T10600.hs new file mode 100644 index 000000000000..86b6e6cbfc55 --- /dev/null +++ b/testsuite/tests/driver/T10600.hs @@ -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 index 000000000000..4298e67dfc8b --- /dev/null +++ b/testsuite/tests/driver/T10600.stderr @@ -0,0 +1,2 @@ +T10600.hs:10:1: + Top-level bindings for unlifted types aren't allowed: foo = 10600# \ No newline at end of file diff --git a/testsuite/tests/driver/T8101.stderr b/testsuite/tests/driver/T8101.stderr index 6fda85797ff8..9f5736044826 100644 --- a/testsuite/tests/driver/T8101.stderr +++ b/testsuite/tests/driver/T8101.stderr @@ -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: diff --git a/testsuite/tests/driver/T8101b.stderr b/testsuite/tests/driver/T8101b.stderr index 555b0362d010..ea8bcf0c4dbc 100644 --- a/testsuite/tests/driver/T8101b.stderr +++ b/testsuite/tests/driver/T8101b.stderr @@ -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: diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T index 09dc79ab7977..7971d46cb333 100644 --- a/testsuite/tests/driver/all.T +++ b/testsuite/tests/driver/all.T @@ -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=.']) -- GitLab