Skip to content

Improve incl_same_name - #93

Merged
fantazio merged 1 commit into
LexiFi:masterfrom
fantazio:name_conflict
Aug 6, 2026
Merged

Improve incl_same_name#93
fantazio merged 1 commit into
LexiFi:masterfrom
fantazio:name_conflict

Conversation

@fantazio

@fantazio fantazio commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

The examples/docs/exported_values/incl_same_name was only testing a simple case, corresponding to #55 (with Oo instead of List).

This PR extends the test to more cases:

  • whether the original module has an mli or not,
  • whether the new module does (using include module type of if it does),
  • and the very corner case of the new module exporting the same value as the original one and at the same location.

The use of Oo is now redundant. Thus, it is removed.
The to_incl subdirectory contains the "original" modules, with and without .mli. The incl_{with|without}_intf define new modules, with and without .mli, which include and are name the same as the original ones.

If we look more closely into the results by using -E calls:1, the calls sites for values used once are also confused:

.>->  ALMOST UNUSED EXPORTED VALUES: Called 1 time(s):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./examples/docs/exported_values/limitations/incl_same_name/incl_with_intf/with_intf.mli:3: used    Call sites:
./examples/docs/exported_values/limitations/incl_same_name/incl_with_intf/use.ml:2:2

./examples/docs/exported_values/limitations/incl_same_name/incl_with_intf/with_intf.mli:5: redefined_used    Call sites:
./examples/docs/exported_values/limitations/incl_same_name/incl_with_intf/use.ml:2:2

./examples/docs/exported_values/limitations/incl_same_name/incl_with_intf/without_intf.ml:3: used    Call sites:
./examples/docs/exported_values/limitations/incl_same_name/incl_with_intf/use.ml:3:2

./examples/docs/exported_values/limitations/incl_same_name/incl_with_intf/without_intf.mli:5: redefined_used    Call sites:
./examples/docs/exported_values/limitations/incl_same_name/incl_with_intf/use.ml:3:2


./examples/docs/exported_values/limitations/incl_same_name/incl_without_intf/with_intf.ml:5: redefined_used    Call sites:
./examples/docs/exported_values/limitations/incl_same_name/incl_with_intf/use.ml:2:2

./examples/docs/exported_values/limitations/incl_same_name/incl_without_intf/with_intf.mli:3: used    Call sites:
./examples/docs/exported_values/limitations/incl_same_name/incl_with_intf/use.ml:2:2

./examples/docs/exported_values/limitations/incl_same_name/incl_without_intf/without_intf.ml:3: used    Call sites:
./examples/docs/exported_values/limitations/incl_same_name/incl_with_intf/use.ml:3:2

./examples/docs/exported_values/limitations/incl_same_name/incl_without_intf/without_intf.ml:5: redefined_used    Call sites:
./examples/docs/exported_values/limitations/incl_same_name/incl_with_intf/use.ml:3:2


./examples/docs/exported_values/limitations/incl_same_name/to_incl/with_intf.mli:3: used    Call sites:
./examples/docs/exported_values/limitations/incl_same_name/incl_with_intf/use.ml:2:2

./examples/docs/exported_values/limitations/incl_same_name/to_incl/without_intf.ml:3: used    Call sites:
./examples/docs/exported_values/limitations/incl_same_name/incl_with_intf/use.ml:3:2

--------

Se how all the call sites point to incl_with_intf/use.ml when some of them should point to to_incl/use.ml or incl_without_intf/use.ml

The test was very trivial, only relying on `Stdlib.Oo`.
It has been enhanced to be self sustainable and expose the behavior for
cases with and without a .mli for the original module and for the new
module.
`Oo` is now redundant with the more complete tests. Thus, it is removed.

Locations are confused both for exported values and their uses.
@fantazio
fantazio merged commit 325703e into LexiFi:master Aug 6, 2026
5 checks passed
@fantazio
fantazio deleted the name_conflict branch August 6, 2026 09:41
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.

1 participant