summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-09-22 18:28:35 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-22 19:20:44 -0400
commit806e49ae36a058dbe4494055a6b936dd153c6194 (patch)
tree982c304986bf925187aae36997d4602e3419c8e9 /testsuite
parent6fd7da745a518a93f6685171701a27283cfe2d4e (diff)
downloadhaskell-806e49ae36a058dbe4494055a6b936dd153c6194.tar.gz
Refactor package imports
Use an (Raw)PkgQual datatype instead of `Maybe FastString` to represent package imports. Factorize the code that renames RawPkgQual into PkgQual in function `rnPkgQual`. Renaming consists in checking if the FastString is the magic "this" keyword, the home-unit unit-id or something else. Bump haddock submodule
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/count-deps/CountDepsAst.stdout3
-rw-r--r--testsuite/tests/count-deps/CountDepsParser.stdout3
-rw-r--r--testsuite/tests/module/mod185.stderr4
-rw-r--r--testsuite/tests/parser/should_compile/DumpParsedAst.stderr2
-rw-r--r--testsuite/tests/parser/should_compile/DumpRenamedAst.stderr6
-rw-r--r--testsuite/tests/parser/should_compile/DumpSemis.stderr8
-rw-r--r--testsuite/tests/parser/should_compile/KindSigs.stderr2
-rw-r--r--testsuite/tests/parser/should_compile/T14189.stderr2
-rw-r--r--testsuite/tests/plugins/defaulting-plugin/DefaultLifted.hs2
-rw-r--r--testsuite/tests/tcplugins/Common.hs3
-rw-r--r--testsuite/tests/tcplugins/RewritePerfPlugin.hs3
11 files changed, 23 insertions, 15 deletions
diff --git a/testsuite/tests/count-deps/CountDepsAst.stdout b/testsuite/tests/count-deps/CountDepsAst.stdout
index 9117f0892c..b557778846 100644
--- a/testsuite/tests/count-deps/CountDepsAst.stdout
+++ b/testsuite/tests/count-deps/CountDepsAst.stdout
@@ -1,4 +1,4 @@
-Found 276 Language.Haskell.Syntax module dependencies
+Found 277 Language.Haskell.Syntax module dependencies
GHC.Builtin.Names
GHC.Builtin.PrimOps
GHC.Builtin.Types
@@ -198,6 +198,7 @@ GHC.Types.Name.Occurrence
GHC.Types.Name.Ppr
GHC.Types.Name.Reader
GHC.Types.Name.Set
+GHC.Types.PkgQual
GHC.Types.RepType
GHC.Types.SafeHaskell
GHC.Types.SourceError
diff --git a/testsuite/tests/count-deps/CountDepsParser.stdout b/testsuite/tests/count-deps/CountDepsParser.stdout
index 2738d7d33f..1e86aeb777 100644
--- a/testsuite/tests/count-deps/CountDepsParser.stdout
+++ b/testsuite/tests/count-deps/CountDepsParser.stdout
@@ -1,4 +1,4 @@
-Found 282 GHC.Parser module dependencies
+Found 283 GHC.Parser module dependencies
GHC.Builtin.Names
GHC.Builtin.PrimOps
GHC.Builtin.Types
@@ -204,6 +204,7 @@ GHC.Types.Name.Occurrence
GHC.Types.Name.Ppr
GHC.Types.Name.Reader
GHC.Types.Name.Set
+GHC.Types.PkgQual
GHC.Types.RepType
GHC.Types.SafeHaskell
GHC.Types.SourceError
diff --git a/testsuite/tests/module/mod185.stderr b/testsuite/tests/module/mod185.stderr
index a0f771ac43..1463324978 100644
--- a/testsuite/tests/module/mod185.stderr
+++ b/testsuite/tests/module/mod185.stderr
@@ -50,7 +50,7 @@
(L
{ mod185.hs:3:8-14 }
{ModuleName: Prelude})
- (Nothing)
+ (NoRawPkgQual)
(NotBoot)
(False)
(QualifiedPost)
@@ -127,3 +127,5 @@
[])))]
(Nothing)
(Nothing)))
+
+
diff --git a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
index d42a808c62..31c2d79256 100644
--- a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
+++ b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
@@ -53,7 +53,7 @@
(L
{ DumpParsedAst.hs:6:8-16 }
{ModuleName: Data.Kind})
- (Nothing)
+ (NoRawPkgQual)
(NotBoot)
(False)
(NotQualified)
diff --git a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
index 84519126fc..d8beda8fa4 100644
--- a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
+++ b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
@@ -1263,7 +1263,7 @@
(L
{ DumpRenamedAst.hs:5:8-21 }
{ModuleName: Prelude})
- (Nothing)
+ (NoPkgQual)
(NotBoot)
(False)
(NotQualified)
@@ -1278,7 +1278,7 @@
(L
{ DumpRenamedAst.hs:6:8-16 }
{ModuleName: Data.Kind})
- (Nothing)
+ (NoPkgQual)
(NotBoot)
(False)
(NotQualified)
@@ -1293,7 +1293,7 @@
(L
{ DumpRenamedAst.hs:8:8-16 }
{ModuleName: Data.Kind})
- (Nothing)
+ (NoPkgQual)
(NotBoot)
(False)
(NotQualified)
diff --git a/testsuite/tests/parser/should_compile/DumpSemis.stderr b/testsuite/tests/parser/should_compile/DumpSemis.stderr
index 05465b8a75..0f5b6f869d 100644
--- a/testsuite/tests/parser/should_compile/DumpSemis.stderr
+++ b/testsuite/tests/parser/should_compile/DumpSemis.stderr
@@ -76,7 +76,7 @@
(L
{ DumpSemis.hs:5:8-16 }
{ModuleName: Data.List})
- (Nothing)
+ (NoRawPkgQual)
(NotBoot)
(False)
(NotQualified)
@@ -115,7 +115,7 @@
(L
{ DumpSemis.hs:7:8-16 }
{ModuleName: Data.Kind})
- (Nothing)
+ (NoRawPkgQual)
(NotBoot)
(False)
(NotQualified)
@@ -2069,4 +2069,6 @@
(FromSource))
[])))]
(Nothing)
- (Nothing))) \ No newline at end of file
+ (Nothing)))
+
+
diff --git a/testsuite/tests/parser/should_compile/KindSigs.stderr b/testsuite/tests/parser/should_compile/KindSigs.stderr
index a8914e9c78..bd9c0deaf0 100644
--- a/testsuite/tests/parser/should_compile/KindSigs.stderr
+++ b/testsuite/tests/parser/should_compile/KindSigs.stderr
@@ -53,7 +53,7 @@
(L
{ KindSigs.hs:8:8-16 }
{ModuleName: Data.Kind})
- (Nothing)
+ (NoRawPkgQual)
(NotBoot)
(False)
(NotQualified)
diff --git a/testsuite/tests/parser/should_compile/T14189.stderr b/testsuite/tests/parser/should_compile/T14189.stderr
index c845817586..eeadfcc06d 100644
--- a/testsuite/tests/parser/should_compile/T14189.stderr
+++ b/testsuite/tests/parser/should_compile/T14189.stderr
@@ -170,7 +170,7 @@
(L
{ T14189.hs:1:8-13 }
{ModuleName: Prelude})
- (Nothing)
+ (NoPkgQual)
(NotBoot)
(False)
(NotQualified)
diff --git a/testsuite/tests/plugins/defaulting-plugin/DefaultLifted.hs b/testsuite/tests/plugins/defaulting-plugin/DefaultLifted.hs
index 62071b9cfb..550a05e116 100644
--- a/testsuite/tests/plugins/defaulting-plugin/DefaultLifted.hs
+++ b/testsuite/tests/plugins/defaulting-plugin/DefaultLifted.hs
@@ -56,7 +56,7 @@ lookupModule mod_nm = do
case found_module of
FoundModule h -> return (fr_mod h)
_ -> do
- found_module' <- findImportedModule mod_nm $ Just $ fsLit "this"
+ found_module' <- findImportedModule mod_nm (ThisPkg (homeUnitId home_unit))
case found_module' of
FoundModule h -> return (fr_mod h)
_ -> panicDoc "Unable to resolve module looked up by plugin: "
diff --git a/testsuite/tests/tcplugins/Common.hs b/testsuite/tests/tcplugins/Common.hs
index e3ec1338a5..3ccc9a4a1b 100644
--- a/testsuite/tests/tcplugins/Common.hs
+++ b/testsuite/tests/tcplugins/Common.hs
@@ -40,6 +40,7 @@ import GHC.Types.Name.Occurrence
( mkClsOcc, mkDataOcc, mkTcOcc )
import GHC.Types.Unique.FM
( UniqFM, emptyUFM )
+import GHC.Types.PkgQual
import GHC.Unit.Finder
( FindResult(..) )
import GHC.Unit.Module
@@ -70,7 +71,7 @@ data PluginDefs =
definitionsModule :: TcPluginM Module
definitionsModule = do
- findResult <- findImportedModule ( mkModuleName "Definitions" ) Nothing
+ findResult <- findImportedModule ( mkModuleName "Definitions" ) NoPkgQual
case findResult of
Found _ res -> pure res
FoundMultiple _ -> error $ "TcPlugin test: found multiple modules named 'Definitions'."
diff --git a/testsuite/tests/tcplugins/RewritePerfPlugin.hs b/testsuite/tests/tcplugins/RewritePerfPlugin.hs
index 8659375c5d..036d89129c 100644
--- a/testsuite/tests/tcplugins/RewritePerfPlugin.hs
+++ b/testsuite/tests/tcplugins/RewritePerfPlugin.hs
@@ -35,6 +35,7 @@ import GHC.Types.Name.Occurrence
( mkTcOcc )
import GHC.Types.Unique.FM
( UniqFM, listToUFM )
+import GHC.Types.PkgQual
import GHC.Unit.Finder
( FindResult(..) )
import GHC.Unit.Module
@@ -54,7 +55,7 @@ type PluginDefs = [ TyCon ]
definitionsModule :: TcPluginM Module
definitionsModule = do
- findResult <- findImportedModule ( mkModuleName "RewritePerfDefs" ) Nothing
+ findResult <- findImportedModule ( mkModuleName "RewritePerfDefs" ) NoPkgQual
case findResult of
Found _ res -> pure res
FoundMultiple _ -> error $ "RewritePerfPlugin: found multiple modules named 'RewritePerfDefs'."