Skip to content

Correct imports with dots and fix documentation of import behaviour#276

Merged
dorchard merged 2 commits intogranule-project:mainfrom
Mr-Pine:separated-import-paths
Dec 18, 2025
Merged

Correct imports with dots and fix documentation of import behaviour#276
dorchard merged 2 commits intogranule-project:mainfrom
Mr-Pine:separated-import-paths

Conversation

@Mr-Pine
Copy link
Contributor

@Mr-Pine Mr-Pine commented Dec 2, 2025

While the documentation in the README claims that an import of A.B.C is resolved to A/B/C.gr while the current code actually resolves it to A.B.C.gr. This PR changes the code behaviour to be on par with the documentation. It adittionally updates the README to explain the two-stage import resolution, first in the cwd, then in the include path.

@Mr-Pine
Copy link
Contributor Author

Mr-Pine commented Dec 2, 2025

As far as I can tell these build/test failures are unrealted to my change, but please correct me if I'm wrong

@dorchard
Copy link
Member

dorchard commented Dec 2, 2025

Thanks for this. We have a hackathon coming up soon so we can review this PR then. Indeed, there are a bunch of tests failing but that's our fault!

Copy link
Contributor

@BinderDavid BinderDavid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified locally on my PC that this now works.

On main:

> gr examples/foo.gr 
Checking examples/foo.gr...
Parse error: examples/foo.gr:
StdLib/Data.Bool.gr: openFile: does not exist (No such file or directory)

On this branch:

> gr examples/foo.gr 
Checking examples/foo.gr...
OK, evaluating...
False

with a file foo.gr

import Data.Bool

f : Bool
f = not True

main : Bool
main = f

@dorchard dorchard merged commit 94f6b6c into granule-project:main Dec 18, 2025
1 check failed
@Mr-Pine Mr-Pine deleted the separated-import-paths branch December 18, 2025 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants