Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Preserve more information about targets #820

Merged
merged 2 commits into from
Sep 18, 2020
Merged

Preserve more information about targets #820

merged 2 commits into from
Sep 18, 2020

Conversation

pepeiborra
Copy link
Collaborator

@pepeiborra pepeiborra commented Sep 17, 2020

The problem we are trying to solve is accurately decide what modules belong to a cradle when there are multiple projects sharing the same source folder, and project membership is driven by a Bios cradle.

For instance, say we have modules A,B,C in the same folder, and A,B should use the same set of flags whereas C should use a different set of flags. For A or B, the Bios cradle will return the set of flags F1 and the targets {A,B}. For C, the Bios cradle will return the set of flags F2 and the set of targets {C}.

While editing A, when finding an import C, ghcide must not allow ghc to load C, and instead must locate it in a package.

The improvement in this PR is to preserve more information from the set of targets returned by the cradle. Targets can be either file paths or modules. Previously we would only store modules, inferring possible module names from file paths targets which was lossy and unnecessary. The change here is to preserve either module names or file paths.

@wz1000
Copy link
Collaborator

wz1000 commented Sep 17, 2020 via email

@pepeiborra
Copy link
Collaborator Author

Why not use GHC.TargetId?

I wanted to, but the phase argument is redundant

@pepeiborra
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@wz1000
Copy link
Collaborator

wz1000 commented Sep 18, 2020

Can't we ignore the phase argument/set it to Nothing?

@pepeiborra
Copy link
Collaborator Author

Can't we ignore the phase argument/set it to Nothing?

We could. Why does it matter?

@wz1000
Copy link
Collaborator

wz1000 commented Sep 18, 2020

Doesn't really, just seems a bit strange to redefine a type that GHC already provides.

This should prevent infinite looping on cradles that do not provide targets,
such as the hie-bios implicit cradle (no longer used)
@pepeiborra pepeiborra merged commit 9cd19eb into master Sep 18, 2020
@pepeiborra pepeiborra deleted the more-targets branch September 18, 2020 08:36
pepeiborra added a commit to pepeiborra/ghcide that referenced this pull request Oct 5, 2020
* Preserve more information about targets

* Correctly model the special target

This should prevent infinite looping on cradles that do not provide targets,
such as the hie-bios implicit cradle (no longer used)
pepeiborra added a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
* Preserve more information about targets

* Correctly model the special target

This should prevent infinite looping on cradles that do not provide targets,
such as the hie-bios implicit cradle (no longer used)
pepeiborra added a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
* Preserve more information about targets

* Correctly model the special target

This should prevent infinite looping on cradles that do not provide targets,
such as the hie-bios implicit cradle (no longer used)
pepeiborra added a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
* Preserve more information about targets

* Correctly model the special target

This should prevent infinite looping on cradles that do not provide targets,
such as the hie-bios implicit cradle (no longer used)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants