-
Notifications
You must be signed in to change notification settings - Fork 392
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
fix(lib-collision): tolerate public_name
collisions in different contexts
#10549
fix(lib-collision): tolerate public_name
collisions in different contexts
#10549
Conversation
…ntexts Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
2e21bd1
to
bacf324
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.
Thanks!
@@ -23,13 +23,6 @@ different folders. | |||
Without any consumers of the libraries | |||
|
|||
$ dune build | |||
File "b/dune", line 3, characters 14-21: |
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.
This behavior is consistent with other cases I think (should be ok)
@@ -51,15 +46,9 @@ With some consumer | |||
> EOF | |||
|
|||
$ cat > main.ml <<EOF | |||
> let () = Foo.x | |||
> let () = print_endline Foo.x |
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.
Did this modification change anything in the test behavior?
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.
It fixed the type errors in compilation
@@ -473,15 +460,22 @@ module DB = struct | |||
| Some lib -> | |||
let name = Package.name pkg in | |||
(name, Lib_entry.Library (Lib.Local.of_lib_exn lib)) :: acc) | |||
| Library.T { visibility = Public pub; _ } -> | |||
let+ lib = Lib.DB.find public_libs (Public_lib.name pub) in | |||
| Library.T { visibility = Public pub; enabled_if; _ } -> |
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.
Why don't private libraries have an enabled_if check?
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.
that's a good point. I'll make these changes shortly.
| Library.T { visibility = Public pub; _ } -> | ||
let+ lib = Lib.DB.find public_libs (Public_lib.name pub) in | ||
| Library.T { visibility = Public pub; enabled_if; _ } -> | ||
let* lib = Lib.DB.find public_libs (Public_lib.name pub) in |
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.
You should use the id rather than the name for this check.
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 tried find_by_lib_id
but I got a crash about adding a duplicate name in https://github.com/ocaml/dune/blob/main/src/dune_rules/install_rules.ml#L697
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'm not sure what that means yet.
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.
Ah, it's likely because it's finding the right lib now.
…ntexts (ocaml#10549) Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
scope.ml
: we store andenabled
Toggle.t Memo.t
that we evaluate when resolving a public library by its name.