summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorShayne Fletcher <shayne.fletcher@digitalasset.com>2019-05-07 17:35:50 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-05-08 15:29:01 -0400
commited5f858b8484a207e28baf9cbec4c60de1c86187 (patch)
tree4dfe0b1ff3970bf2cac267299251e803f7ced7e8 /testsuite
parent0eeb4cfad732d0b9b278c2274cb6db9633f9d3b5 (diff)
downloadhaskell-ed5f858b8484a207e28baf9cbec4c60de1c86187.tar.gz
Implement ImportQualifiedPost
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/driver/T4437.hs3
-rw-r--r--testsuite/tests/module/all.T6
-rw-r--r--testsuite/tests/module/mod181.hs8
-rw-r--r--testsuite/tests/module/mod182.hs7
-rw-r--r--testsuite/tests/module/mod182.stderr3
-rw-r--r--testsuite/tests/module/mod183.hs7
-rw-r--r--testsuite/tests/module/mod183.stderr1
-rw-r--r--testsuite/tests/module/mod184.hs8
-rw-r--r--testsuite/tests/module/mod184.stderr3
-rw-r--r--testsuite/tests/parser/should_compile/DumpParsedAst.stderr4
-rw-r--r--testsuite/tests/parser/should_compile/DumpRenamedAst.stderr8
-rw-r--r--testsuite/tests/parser/should_compile/KindSigs.stderr2
-rw-r--r--testsuite/tests/parser/should_compile/T14189.stderr4
13 files changed, 51 insertions, 13 deletions
diff --git a/testsuite/tests/driver/T4437.hs b/testsuite/tests/driver/T4437.hs
index 5ae423086a..2f28c05ec2 100644
--- a/testsuite/tests/driver/T4437.hs
+++ b/testsuite/tests/driver/T4437.hs
@@ -40,7 +40,8 @@ expectedGhcOnlyExtensions = ["RelaxedLayout",
"AlternativeLayoutRule",
"AlternativeLayoutRuleTransitional",
"EmptyDataDeriving",
- "GeneralisedNewtypeDeriving"]
+ "GeneralisedNewtypeDeriving",
+ "ImportQualifiedPost"]
expectedCabalOnlyExtensions :: [String]
expectedCabalOnlyExtensions = ["Generics",
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.
diff --git a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
index 5c8bb34e50..d290e61da1 100644
--- a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
+++ b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
@@ -16,7 +16,7 @@
(Nothing)
(False)
(False)
- (False)
+ (NotQualified)
(False)
(Nothing)
(Nothing)))]
@@ -458,5 +458,3 @@
[])))]
(Nothing)
(Nothing)))
-
-
diff --git a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
index 8dd85edcd6..48b880b16d 100644
--- a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
+++ b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
@@ -642,7 +642,7 @@
(Nothing)
(False)
(False)
- (False)
+ (NotQualified)
(True)
(Nothing)
(Nothing)))
@@ -655,7 +655,7 @@
(Nothing)
(False)
(False)
- (False)
+ (NotQualified)
(False)
(Nothing)
(Nothing)))
@@ -668,7 +668,7 @@
(Nothing)
(False)
(False)
- (False)
+ (NotQualified)
(False)
(Nothing)
(Just
@@ -684,5 +684,3 @@
{Name: GHC.Types.Type})))))])))))]
(Nothing)
(Nothing)))
-
-
diff --git a/testsuite/tests/parser/should_compile/KindSigs.stderr b/testsuite/tests/parser/should_compile/KindSigs.stderr
index 8ea6ec5322..6c7ef797a1 100644
--- a/testsuite/tests/parser/should_compile/KindSigs.stderr
+++ b/testsuite/tests/parser/should_compile/KindSigs.stderr
@@ -16,7 +16,7 @@
(Nothing)
(False)
(False)
- (False)
+ (NotQualified)
(False)
(Nothing)
(Nothing)))]
diff --git a/testsuite/tests/parser/should_compile/T14189.stderr b/testsuite/tests/parser/should_compile/T14189.stderr
index dd8df9dc04..e405262c5c 100644
--- a/testsuite/tests/parser/should_compile/T14189.stderr
+++ b/testsuite/tests/parser/should_compile/T14189.stderr
@@ -109,7 +109,7 @@
(Nothing)
(False)
(False)
- (False)
+ (NotQualified)
(True)
(Nothing)
(Nothing)))]
@@ -141,5 +141,3 @@
(False)
{Name: T14189.f})])])])
(Nothing)))
-
-