-
Notifications
You must be signed in to change notification settings - Fork 20
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
Move trait methods in cyclic dependencies bundling. #1075
base: main
Are you sure you want to change the base?
Conversation
Mmh, here the problem is that we assume (in the F* backend!) that a top-level Also, we want to get rid of type-classes in F*, when we will do so, things will break. I see two options:
What do you think? Would (2) be easy enough? I won't have time to do (1) before my holidays. |
I am not sure (1) would work because then things in the bundle could still refer to the original module creating a cyclic dependency. And if the plan is to get rid of type classes someday I guess (2) makes sense. I'll try to do something like that. |
Actually I think what we want is a modified version of what I implemented in this PR. We want to do the renaming of references to the trait method, we just don't want the The problem with this approach is if we translate a library (that contains a trait that gets bundled) and then some other crate that uses the trait from the library. If we translate them with two different applications of hax, then we might refer to the trait methods in the wrong module. But is it possible to translate things independently like that @W95Psp ? |
Yes, I agree: we want to renaming, but maybe not the And yes, definitively, this would be an issue when we extract two different crates where one uses the other. |
After discussing this the decision is to go with (2). We'll open an issue to get rid of this once we stop using fstar type classes. |
…ly for fstar (hack).
let trait_methods_renamings = | ||
match from_ident old_name with | ||
| Some { v = Trait { items; _ }; _ } | ||
when not !includes_for_bundled_trait_methods -> |
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.
I was expecting to see a condition based on includes_for_bundled_trait_methods
only at the place where you create Alias
. I don't get why there are two.
Unrelated to this PR, I think the arguments to shallow_copy
are getting unclear. I wonder if we should not inline this function: the argument variants_renamings
looks unrelated to the notion of "making a shallow copy".
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.
Yes, maybe we should refactor. The thing is where we create aliases, we also do the renaming. But in case we don't create aliases we still want to do the renaming (but we don't want to do it twice in the other case). So that's why we have this condition here (but maybe we could improve).
Fixes #1068