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:
parent
8bbf089d63
commit
c6586a960d
5
include/package/Package.juvix
Normal file
5
include/package/Package.juvix
Normal file
@ -0,0 +1,5 @@
|
||||
module Package;
|
||||
|
||||
import PackageDescription.Basic open;
|
||||
|
||||
package : Package := basicPackage;
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user