-
Notifications
You must be signed in to change notification settings - Fork 150
Qualified type aliases support #2550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qualified type aliases support #2550
Conversation
After many experiments, some error tracing, and much code analysis, a comment on the progress is due:
We speculate that a comprehensive solution to this matter would be to have a mechanism to explicitly export and re-export aliases (or other LH specs). Nevertheless, that approach exceeds the scope of my GSoC project and is left for future work. Going forward, I'll make sure that aliases from transitive dependencies actually populate a module's Footnotes
|
Now that this PR is ready for review, I'll provide an overview of the proposed changes: In brief, we can now qualify aliases to disambiguate cases where two imports export type aliases with the same name. The approach we followed succeeded: by using the It turns out type alias environments are created at four different stages:
In all these cases, the environments were built from the aliases of the current module and all its transitive dependencies. For the qualified alias approach to work, I had to make changes at all of these sites. Accordingly:
To summarize:Previously, all transitive dependencies were considered during Now, we ensure that all type aliases from transitive dependencies are included in the |
a645a4f
to
606a450
Compare
f1df1f7
to
541059f
Compare
2e913b9
to
af632d1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quite a good piece of work! I think the standing comments won't be difficult to address.
liquidhaskell-boot/src/Language/Haskell/Liquid/LHNameResolution.hs
Outdated
Show resolved
Hide resolved
liquidhaskell-boot/src/Language/Haskell/Liquid/LHNameResolution.hs
Outdated
Show resolved
Hide resolved
liquidhaskell-boot/src/Language/Haskell/Liquid/LHNameResolution.hs
Outdated
Show resolved
Hide resolved
liquidhaskell-boot/src/Language/Haskell/Liquid/LHNameResolution.hs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements support for qualified type aliases in LiquidHaskell, allowing users to disambiguate between type aliases with the same name from different modules by using qualified names. The main change is updating the rtName
field in RTAlias
from Symbol
to LHName
to track module origin and enable proper name resolution.
Key changes include:
- Enhanced type alias name resolution with support for qualified names and ambiguity detection
- Updated alias environment management to handle module aliases and scope resolution
- Extended test coverage with comprehensive scenarios for qualified and ambiguous type aliases
Reviewed Changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 6 comments.
Show a summary per file
File | Description |
---|---|
liquidhaskell-boot/src/Language/Haskell/Liquid/Types/Types.hs | Core type change from Symbol to LHName for alias names |
liquidhaskell-boot/src/Language/Haskell/Liquid/LHNameResolution.hs | Major refactoring of name resolution logic with qualified alias support |
liquidhaskell-boot/src/Language/Haskell/Liquid/Bare/Expand.hs | Updated alias expansion to work with LHName-based lookups |
tests/names/pos/*.hs | New test files demonstrating qualified alias functionality |
tests/names/neg/*.hs | New negative test cases for ambiguous aliases |
liquidhaskell-boot/src/Language/Haskell/Liquid/LHNameResolution.hs
Outdated
Show resolved
Hide resolved
0685a87
to
a428c8f
Compare
Co-authored-by: Facundo Domínguez <facundominguez@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ecd4142
to
2f9d5cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Well done @ninioArtillero!
I began by manually following the call stack of the plugin to find relevant places where
aliases are manipulated.
Started with my GSoC 2025 proposal's solution strategy by changing the
rtName
field of the type for aliases fromSymbol
toLHName
and fixing compiler warnings to give theSymbol
s back where they are expected.This is work towards #2481