tweag/ormolu

An issue with inter-package re-exports

Closed this issue · 0 comments

mrkkrp commented

When a module re-exports another module from a different package and that package is not specified as a direct dependency of the component we are formatting we are likely going to get incorrect fixity information because the set of packages from which that information is drawn is restricted before re-exports are taken into consideration.

Possible solution:

  • Equip re-export targets also with package names. This was my original design where both the exporting module and the exported modules were fully qualified, i.e. with package names, but that introduced quite a bit of complexity and this corner case did not come to my mind, so I simplified the design.
  • Over-approximate the set of packages we need by including all packages that can be re-export targets. This is simple and should not have any adverse side-effects because the actual fixity resolution process is controlled by the imports. Restricting the package set is only an optimization measure.