1
1
mirror of https://github.com/anoma/juvix.git synced 2024-11-30 14:13:27 +03:00

Fix the global 'package' package so that modules within it can be type-checked independently (#2526)

This PR adds a Package.juvix file to the global 'package' package (that
is the package containing the `PackageDescription.{Basic, V1}` modules.

This means that users can now go-to-definition on Package.juvix types
and identifiers and navigate to fully highlighted
`PackageDescription.{Basic, V1}` modules.

* Closes https://github.com/anoma/juvix/issues/2525
This commit is contained in:
Paul Cadman 2023-11-21 15:20:00 +00:00 committed by GitHub
parent 8bbf089d63
commit c6586a960d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 6 deletions

View File

@ -0,0 +1,5 @@
module Package;
import PackageDescription.Basic open;
package : Package := basicPackage;

View File

@ -49,18 +49,18 @@ runPackagePathResolver rootPath sem = do
{ _rootInfoPath = globalStdlib,
_rootInfoKind = RootKindPackage
}
| relPath `HashSet.member` pkgFiles =
Just $
RootInfo
{ _rootInfoPath = globalPackageDir,
_rootInfoKind = RootKindPackage
}
| relPath == packageFilePath =
Just $
RootInfo
{ _rootInfoPath = rootPath,
_rootInfoKind = RootKindPackage
}
| relPath `HashSet.member` pkgFiles =
Just $
RootInfo
{ _rootInfoPath = globalPackageDir,
_rootInfoKind = RootKindPackage
}
| otherwise = Nothing
runPackagePathResolver' :: (Members '[TaggedLock, Files] r) => Path Abs Dir -> Sem (PathResolver ': r) a -> Sem r (ResolverState, a)

View File

@ -55,6 +55,28 @@ tests:
equals: "Well done! It type checks\n"
exit-status: 0
- name: typecheck-package-description
command:
shell:
- bash
script: |
base=$PWD
temp=$(mktemp -d)
trap 'rm -rf -- "$temp"' EXIT
configDir=$temp/config
projDir=$temp/projDir
mkdir $configDir
export XDG_CONFIG_HOME="$configDir"
mkdir $projDir
cd $projDir
# side-effect: initializes the global project / the package package
globalPackageDir=$(juvix dev root)
packagePackageDir="$(dirname $globalPackageDir)"/package
juvix typecheck "$packagePackageDir/PackageDescription/V1.juvix"
stdout:
equals: "Well done! It type checks\n"
exit-status: 0
- name: typecheck-stdin
command:
- juvix