Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 5.5k
    • Issues 5.5k
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 638
    • Merge requests 638
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Merge requests
  • !6586

Refactor package imports

  • Review changes

  • Download
  • Patches
  • Plain diff
Closed Sylvain Henry requested to merge hsyl20/ghc:hsyl20/pkgqual into master Sep 23, 2021
  • Overview 18
  • Commits 2
  • Pipelines 13
  • Changes 46

The way we handle package imports was quite fragile as identified in fb7c3117:

In doing this I tripped across the specialness of "this" in
PackageImports.  The magic constant (fsLit "this") is scattered across
the compiler and ought to be put in one place.  But where?

We're now doing it properly in the renamer. Commit message:

Use an (Raw)PkgQual datatype instead of `Maybe FastString` to represent
package imports. Factorize the code that renames RawPkgQual into PkgQual
in function `rnPkgQual`. Renaming consists in checking if the FastString
is the magic "this" keyword, the home-unit unit-id or something else.

The first commit is a refactoring that makes the use of lookupPackageName simpler.

(found while trying to understand how imports are handled to fix #20218 (closed))

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: hsyl20/pkgqual