diff options
author | Shayne Fletcher <shayne.fletcher@digitalasset.com> | 2019-05-07 17:35:50 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-05-08 15:29:01 -0400 |
commit | ed5f858b8484a207e28baf9cbec4c60de1c86187 (patch) | |
tree | 4dfe0b1ff3970bf2cac267299251e803f7ced7e8 /testsuite/tests/module | |
parent | 0eeb4cfad732d0b9b278c2274cb6db9633f9d3b5 (diff) | |
download | haskell-ed5f858b8484a207e28baf9cbec4c60de1c86187.tar.gz |
Implement ImportQualifiedPost
Diffstat (limited to 'testsuite/tests/module')
-rw-r--r-- | testsuite/tests/module/all.T | 6 | ||||
-rw-r--r-- | testsuite/tests/module/mod181.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/module/mod182.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/module/mod182.stderr | 3 | ||||
-rw-r--r-- | testsuite/tests/module/mod183.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/module/mod183.stderr | 1 | ||||
-rw-r--r-- | testsuite/tests/module/mod184.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/module/mod184.stderr | 3 |
8 files changed, 43 insertions, 0 deletions
diff --git a/testsuite/tests/module/all.T b/testsuite/tests/module/all.T index 6ff69b0758..2a26edb6e1 100644 --- a/testsuite/tests/module/all.T +++ b/testsuite/tests/module/all.T @@ -263,6 +263,12 @@ test('mod179', [extra_files(['Mod179_A.hs'])], multimod_compile, ['mod179', '-v0 test('mod180', [extra_files(['Mod180_A.hs', 'Mod180_B.hs'])], multimod_compile_fail, ['mod180', '-v0']) +# Tests for 'ImportQualifiedPost' +test('mod181', normal, compile, ['']) +test('mod182', normal, compile_fail, ['']) +test('mod183', normal, compile_fail, ['']) +test('mod184', normal, compile, ['-Wprepositive-qualified-module']) + test('T1148', normal, compile, ['']) test('T1074', normal, compile, ['']) test('T1074a', normal, compile, ['']) diff --git a/testsuite/tests/module/mod181.hs b/testsuite/tests/module/mod181.hs new file mode 100644 index 0000000000..df8b8d0aa4 --- /dev/null +++ b/testsuite/tests/module/mod181.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE ImportQualifiedPost #-} + +-- If 'ImportQualifiedPost' is enabled 'qualified' can appear in +-- postpositive position. + +import Prelude qualified + +main = Prelude.undefined diff --git a/testsuite/tests/module/mod182.hs b/testsuite/tests/module/mod182.hs new file mode 100644 index 0000000000..379fb3849f --- /dev/null +++ b/testsuite/tests/module/mod182.hs @@ -0,0 +1,7 @@ + +-- If 'ImportQualifiedPost' is not enabled 'qualified' can not appear in +-- postpositive position. + +import Prelude qualified + +main = Prelude.undefined diff --git a/testsuite/tests/module/mod182.stderr b/testsuite/tests/module/mod182.stderr new file mode 100644 index 0000000000..2909298220 --- /dev/null +++ b/testsuite/tests/module/mod182.stderr @@ -0,0 +1,3 @@ +mod182.hs:5:16: error: + Found ‘qualified’ in postpositive position. + To allow this, enable language extension 'ImportQualifiedPost' diff --git a/testsuite/tests/module/mod183.hs b/testsuite/tests/module/mod183.hs new file mode 100644 index 0000000000..37d627645c --- /dev/null +++ b/testsuite/tests/module/mod183.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE ImportQualifiedPost #-} + +-- 'qualified' can not appear in both pre and postpositive positions. + +import qualified Prelude qualified + +main = Prelude.undefined diff --git a/testsuite/tests/module/mod183.stderr b/testsuite/tests/module/mod183.stderr new file mode 100644 index 0000000000..cf7fdf4fa0 --- /dev/null +++ b/testsuite/tests/module/mod183.stderr @@ -0,0 +1 @@ +mod183.hs:5:26: Multiple occurences of 'qualified' diff --git a/testsuite/tests/module/mod184.hs b/testsuite/tests/module/mod184.hs new file mode 100644 index 0000000000..7ccc78eafb --- /dev/null +++ b/testsuite/tests/module/mod184.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE ImportQualifiedPost #-} + +-- With '-Wprepositive-qualified-module', a prepositive qualified +-- import should warn. + +import qualified Prelude + +main = Prelude.undefined diff --git a/testsuite/tests/module/mod184.stderr b/testsuite/tests/module/mod184.stderr new file mode 100644 index 0000000000..65e8ff2aaa --- /dev/null +++ b/testsuite/tests/module/mod184.stderr @@ -0,0 +1,3 @@ +mod184.hs:6:8: warning: [-Wprepositive-qualified-module] + Found ‘qualified’ in prepositive position + Suggested fix: place ‘qualified’ after the module name instead. |