From aa054b0aee7c936c107e111e42f287f0d37edfc8 Mon Sep 17 00:00:00 2001 From: Jan Mas Rovira Date: Mon, 9 Sep 2024 13:53:31 +0200 Subject: [PATCH 1/2] fix location of scoped modulePathName --- .../Concrete/Translation/FromParsed/Analysis/Scoping.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs index a51525e63a..1e254786f9 100644 --- a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs +++ b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs @@ -612,7 +612,7 @@ checkImportNoPublic :: checkImportNoPublic import_@Import {..} = do massert (_importPublic == NoPublic) smodule <- readScopeModule import_ - let sname :: S.TopModulePath = smodule ^. scopedModulePath + let sname :: S.TopModulePath = set nameConcrete _importModulePath (smodule ^. scopedModulePath) sname' :: S.Name = set S.nameConcrete (topModulePathToName _importModulePath) sname scopedModule :: ScopedModule = set scopedModuleName sname' smodule exportInfoOriginal = scopedModule ^. scopedModuleExportInfo @@ -638,7 +638,8 @@ checkImportNoPublic import_@Import {..} = do _importAsName = qual', _importOpen = importOpen', _importUsingHiding = usingHiding', - .. + _importKw, + _importPublic } where addModuleToScope :: ScopedModule -> Sem r () From 6d4fa155f81fa76c5161733537c1f75bfd10750a Mon Sep 17 00:00:00 2001 From: Jan Mas Rovira Date: Mon, 9 Sep 2024 14:38:19 +0200 Subject: [PATCH 2/2] add test --- test/Scope/Positive.hs | 4 ++++ tests/positive/issue2737/M.juvix | 9 +++++++++ tests/positive/issue2737/Package.juvix | 8 ++++++++ tests/positive/issue2737/main.juvix | 5 +++++ 4 files changed, 26 insertions(+) create mode 100644 tests/positive/issue2737/M.juvix create mode 100644 tests/positive/issue2737/Package.juvix create mode 100644 tests/positive/issue2737/main.juvix diff --git a/test/Scope/Positive.hs b/test/Scope/Positive.hs index 2c27ecdafa..895e142829 100644 --- a/test/Scope/Positive.hs +++ b/test/Scope/Positive.hs @@ -265,5 +265,9 @@ tests = posTest "Scan name with 'import' prefix" $(mkRelDir "issue2929") + $(mkRelFile "main.juvix"), + posTest + "Proper formatting of import module path" + $(mkRelDir "issue2737") $(mkRelFile "main.juvix") ] diff --git a/tests/positive/issue2737/M.juvix b/tests/positive/issue2737/M.juvix new file mode 100644 index 0000000000..4e13b189ae --- /dev/null +++ b/tests/positive/issue2737/M.juvix @@ -0,0 +1,9 @@ +-- 1 +-- 2 +-- 3 +-- 4 +-- 5 +-- 6 +-- 7 +-- 8 +module M; diff --git a/tests/positive/issue2737/Package.juvix b/tests/positive/issue2737/Package.juvix new file mode 100644 index 0000000000..6a54fa0cd3 --- /dev/null +++ b/tests/positive/issue2737/Package.juvix @@ -0,0 +1,8 @@ +module Package; + +import PackageDescription.V2 open; + +package : Package := + defaultPackage@?{ + name := "issue2737" + }; diff --git a/tests/positive/issue2737/main.juvix b/tests/positive/issue2737/main.juvix new file mode 100644 index 0000000000..e357002b58 --- /dev/null +++ b/tests/positive/issue2737/main.juvix @@ -0,0 +1,5 @@ +module main; + +import M as N; + +-- comment at the end