enso-org / enso

Hybrid visual and textual functional programming.
https://enso.org
Apache License 2.0
7.34k stars 320 forks source link

Compilation fails if a private module is created inside of a directory that has an Enso file with the same name #9526

Open radeusgd opened 5 months ago

radeusgd commented 5 months ago

It is possible and used in Enso to create following structures:

|- distribution/lib/Standard/Base/0.0.0-dev/src/Network/
   |- HTTP
   |  |- Request.enso
   |  |...
   |- HTTP.enso

However, I found out that if I add a private module inside of such an 'aliased' parent module, this fails with compiler error.

Repro: testproject1.zip image

When such project is ran, it results in:

<Unknown source>: error: Cannot export private module 'local.Testproject1.Mod.Bar'
Aborting due to 1 errors and 0 warnings.
Execution finished with an error: Compilation aborted due to errors.

It should be normally possible to mark modules as private inside of such a structure.

If I remove the private mark from Bar.enso, the problem goes away.

radeusgd commented 5 months ago

I suspect it may have something to do with the synthetic re-exports that are generated for the sub-modules. Probably all sub-modules are tried to be re-exported, but then if one of them is private, the PrivateModuleAnalysis pass fails on this synthetic export.

radeusgd commented 5 months ago

I imagine this is relatively low priority, as we probably should follow the convention anyway of putting such private modules inside of Internal submodule, which would not have such aliased Internal.enso that causes the trouble here.

Still worth noting as the behaviour is rather incorrect.