8000 test: demonstrate regression depending on a ppx by its private name by anmonteiro · Pull Request #7553 · ocaml/dune · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

test: demonstrate regression depending on a ppx by its private name #7553

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

Merged
merged 2 commits into from
Apr 17, 2023

Conversation

anmonteiro
Copy link
Collaborator

@anmonteiro anmonteiro force-pushed the anmonteiro/repro-ppx-scope-issue branch from 1def7ba to a404a79 Compare April 14, 2023 07:51
@anmonteiro anmonteiro force-pushed the anmonteiro/repro-ppx-scope-issue branch from a404a79 to 21502c4 Compare April 15, 2023 06:14
@anmonteiro
Copy link
Collaborator Author
anmonteiro commented Apr 15, 2023

@rgrinberg I pushed a fix for this, guaranteeing that we return the same scope if there's no host scope.

@anmonteiro anmonteiro force-pushed the anmonteiro/repro-ppx-scope-issue branch from 21502c4 to 19155f0 Compare April 15, 2023 20:01
@anmonteiro anmonteiro requested a review from rgrinberg April 15, 2023 21:32
@anmonteiro anmonteiro force-pushed the anmonteiro/repro-ppx-scope-issue branch from 19155f0 to 52126ff Compare April 15, 2023 21:43
| Some context_host ->
let+ scope = Scope.DB.find_by_dir context_host.build_dir in
Some scope
in
Copy link
Member

Choose a reason for hiding this comment

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

There's another piece of code in this file that looks suspicious:

  let expander_for_artifacts ~scope ~external_env ~root_expander ~dir =
    Expander.extend_env root_expander ~env:external_env
    |> Expander.set_scope ~scope |> Expander.set_dir ~dir

It doesn't seem right to set the scope without setting the scope_host appropriately. I guess we can fix this on another occasion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was just typing this in another comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the current fix is in the wrong place.

Copy link
Member

Choose a reason for hiding this comment

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

There's a simpler way to derive the scope_host from the scope that perhaps we should follow:

  1. Get the root directory of scope.
  2. Transform this directory to the analogous directory in the host's context
  3. Call Scope.DB.find_by_dir on it.

This kind of complicates my refactoring of making source tree context based, but it's ok for now.

Copy link
Member

Choose a reason for hiding this comment

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

So for this change, you would need a ; context_host : Context.t option field rather than a scope_host.

Copy link
Member

Choose a reason for hiding this comment

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

Or perhaps we should modify set_scope to take both the scope and the scope_host. and move this logic to whoever is calling set_scope. It seems good to keep Expander relatively oblivious to cross compilation logic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I pushed the version where scope_host is derived from context. I'll explore the version where set_scope takes scope_host now and see if I like it better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Pushed the set_scope fix instead, which is a lot more minimal. Let me know what you think.

@anmonteiro anmonteiro force-pushed the anmonteiro/repro-ppx-scope-issue branch 2 times, most recently from c0a4ca7 to 9fa4123 Compare April 15, 2023 22:25
Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
@anmonteiro anmonteiro force-pushed the anmonteiro/repro-ppx-scope-issue branch from 9fa4123 to 5981ac5 Compare April 17, 2023 17:30
@anmonteiro anmonteiro requested a review from rgrinberg April 17, 2023 17:35
@rgrinberg
Copy link
Member

I wonder if we have a similar issue for artifacts.

@anmonteiro
8000 Copy link
Collaborator Author

Looks like Expander.set_bin_artifacts sets the host artifacts already

let set_bin_artifacts t ~bin_artifacts_host = { t with bin_artifacts_host }

@anmonteiro anmonteiro merged commit 9f12490 into ocaml:main Apr 17, 2023
@anmonteiro anmonteiro deleted the anmonteiro/repro-ppx-scope-issue branch April 17, 2023 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0