|
11 | 11 | + [Limitations](#limitations) |
12 | 12 | + [Module type](#module-type) |
13 | 13 | + [Include module type with substitution](#include-module-type-with-substitution) |
| 14 | + + [Including a module with same name](#including-a-module-with-the-same-name) |
14 | 15 |
|
15 | 16 | # Exported Values |
16 | 17 |
|
@@ -318,3 +319,72 @@ make: Leaving directory '/tmp/docs/exported_values/limitations/sigincl' |
318 | 319 |
|
319 | 320 | The analyzer reports `I.x` at the line where `T` is included although it is |
320 | 321 | actually declared in `T`. |
| 322 | + |
| 323 | +## Including a module with the same name |
| 324 | + |
| 325 | +Related issue : |
| 326 | +[issue #55](https://github.com/LexiFi/dead_code_analyzer/issues/55). |
| 327 | + |
| 328 | +According to the semantics described in the |
| 329 | +[Include](./code_constructs/INCLUDE.md) example, values re-exported via included |
| 330 | +should not be reported. However, it may happen that values re-exported by |
| 331 | +including a compilation unit out of the current codebase are reported when the |
| 332 | +re-exporting compilation unit has the same name as the one included. |
| 333 | + |
| 334 | +### Example |
| 335 | + |
| 336 | +The reference files for this example are in the |
| 337 | +[incl\_same\_name](../examples/docs/exported_values/limitations/incl_same_name) |
| 338 | +directory. |
| 339 | + |
| 340 | +The reference takes place in `/tmp/docs/exported_values/limitations`, which |
| 341 | +is a copy of the [limitations](../examples/docs/exported_values/limitations) |
| 342 | +directory. Reported locations may differ depending on the location of the source |
| 343 | +files. |
| 344 | + |
| 345 | +The compilation command is : |
| 346 | +``` |
| 347 | +make -C incl_same_name build |
| 348 | +``` |
| 349 | + |
| 350 | +The analysis command is : |
| 351 | +``` |
| 352 | +make -C incl_same_name analyze |
| 353 | +``` |
| 354 | + |
| 355 | +The compile + analyze command is : |
| 356 | +``` |
| 357 | +make -C incl_same_name |
| 358 | +``` |
| 359 | + |
| 360 | +Code: |
| 361 | +```OCaml |
| 362 | +(* oo.ml *) |
| 363 | +include Stdlib.Oo |
| 364 | +``` |
| 365 | + |
| 366 | +Compile and analyze: |
| 367 | +``` |
| 368 | +$ make -C incl_same_name |
| 369 | +make: Entering directory '/tmp/docs/exported_values/limitations/incl_same_name' |
| 370 | +ocamlopt -bin-annot oo.ml |
| 371 | +dead_code_analyzer --nothing -E all . |
| 372 | +Scanning files... |
| 373 | + [DONE] |
| 374 | +
|
| 375 | +.> UNUSED EXPORTED VALUES: |
| 376 | +========================= |
| 377 | +/tmp/docs/exported_values/limitations/incl_same_name/oo.mli:20: copy |
| 378 | +/tmp/docs/exported_values/limitations/incl_same_name/oo.mli:25: id |
| 379 | +/tmp/docs/exported_values/limitations/incl_same_name/oo.mli:40: new_method |
| 380 | +/tmp/docs/exported_values/limitations/incl_same_name/oo.mli:41: public_method_label |
| 381 | +
|
| 382 | +Nothing else to report in this section |
| 383 | +-------------------------------------------------------------------------------- |
| 384 | +
|
| 385 | +
|
| 386 | +make: Leaving directory '/tmp/docs/exported_values/limitations/incl_same_name' |
| 387 | +``` |
| 388 | + |
| 389 | +The analyzer reports values in `oo.mli` although they are included from |
| 390 | +`Stdlib.Oo`. |
0 commit comments