Skip to content
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

Individual identifiers are not exported if their parent module is exported in the same unit #4718

Closed
wdanilo opened this issue Feb 5, 2023 · 0 comments
Assignees
Labels
--bug Type: bug -syntax p-low Low priority

Comments

@wdanilo
Copy link
Member

wdanilo commented Feb 5, 2023

This task is automatically imported from the old Task Issue Board and it was originally created by Radosław Waśko.
Original issue is here.


In short, if I have a module F1 defining Fst and in another module do:

import project.F1
export project.F1
from project.F1 export Fst

the identifier Fst will not be exported.

To reproduce the issue create a new project with three files:

  • F1.enso:
    type ISR
        Fst
        Lst
        Whl
    
  • F2.enso:
    import project.F1
    export project.F1
    from project.F1 export Fst, Lst
    
  • Main.enso:
    from Standard.Base import all
    from project.F2 import all
    
    main = 
        IO.println F1
        IO.println Fst
    

When running the project I'd expect output:

F1
Fst

but instead I get:

In module local.Project_123.Main:
Compiler encountered errors:
Main.enso[6:16-6:18]: The name `Fst` could not be found.
Execution finished with an error: Compilation aborted due to errors.

If I remove the line export project.F1 from F2 OR if I move it after the from project.F1 export Fst, I will get:

In module local.Project_123.Main:
Compiler encountered errors:
Main.enso[5:16-5:17]: The name `F1` could not be found.
Execution finished with an error: Compilation aborted due to errors.

So it seems like only one export directive from each module is allowed and all subsequent ones are skipped?

Additional Notes

This bug prevented us from exporting Index_Sub_Range in one of the PRs, ideally once it is resolved, we should export Index_Sub_Range from Standard.Base and then remove the, then obsolete, imports of import Standard.Base.Data.Index_Sub_Range.

Comments:

Looks like everything works as expected with F2.enso defined as

import project.F1
import project.F1.ISR
export project.F1
from project.F1.ISR export Fst,Lst

which was needed after the whole change in type semantics (Hubert Plociniczak - Nov 18, 2022)


A slightly modified version of the original description: `F1.enso`: ``` foo = 42 bar = "z" ``` `F2.enso`: ``` import project.F1 export project.F1 from project.F1 export foo ``` `Main.enso`: ``` from Standard.Base import all from project.F2 import all

main =
IO.println F1.bar
IO.println foo

This one doesn't work (`foo` is not found). (Hubert Plociniczak - Nov 18, 2022)
<hr />
So the problem is here - https://github.com/enso-org/enso/blob/9361cfe3ffff68b19abab9d333d70e627d8c4cde/engine/runtime/src/main/scala/org/enso/compiler/phase/ImportResolver.scala#L125 we only select a single export with the given name.  (Hubert Plociniczak - Nov 18, 2022)
<hr />
**Hubert Plociniczak** reports a new **STANDUP** for the last Friday (2022-11-18):

**Progress:** Investigating the source of the problem of the imports bug. Turns out we explicitly pick the first module export and discard the rest. It should be finished by 2022-11-22.

**Next Day:** Next day I will be working on the [#183092447 task](https://www.pivotaltracker.com/story/show/183092447). Source of the problem is known and reproducible, need to figure out the best way to tackle it. (Enso Bot - Nov 21, 2022)
<hr />
**Hubert Plociniczak** reports a new **STANDUP** for yesterday (2022-11-21):

**Progress:** Working on a fix. Detecting scenarios that can now lead to conflicts when multiple exports are allowed. It should be finished by 2022-11-22.

**Next Day:** Next day I will be working on the [#183092447 task](https://www.pivotaltracker.com/story/show/183092447). Finish tests, create a PR. (Enso Bot - Nov 22, 2022)
<hr />
**Hubert Plociniczak** reports a new **STANDUP** for yesterday (2022-11-22):

**Progress:** Finished the PR, waiting on review. Moved on to #183833055 which has a couple of subtasks. Figured out that 1. will be solved by #183092447. Investigating 2. on how to make extensions methods not to creep into the scope of imports. It should be finished by 2022-11-22.

**Next Day:** Next day I will be working on the [#183833055 task](https://www.pivotaltracker.com/story/show/183833055). Continue on fixing issues with imports. (Enso Bot - Nov 23, 2022)
<hr />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--bug Type: bug -syntax p-low Low priority
Projects
None yet
Development

No branches or pull requests

2 participants