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

Spurious duplicated import warning #12376

Open
radeusgd opened this issue Feb 27, 2025 · 2 comments
Open

Spurious duplicated import warning #12376

radeusgd opened this issue Feb 27, 2025 · 2 comments
Assignees
Labels
--bug Type: bug -compiler p-low Low priority

Comments

@radeusgd
Copy link
Member

While working on #12357 I've found a situation where the compiler is reporting a spurious warning.

The minimal patch I've found to reproduce it is:

diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Foo.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Foo.enso
new file mode 100644
--- /dev/null	(date 1740646706287)
+++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Foo.enso	(date 1740646706287)
@@ -0,0 +1,3 @@
+from project.Column import apply_unary_operation, naming_helper
+
+foo = [Column, apply_unary_operation, naming_helper]

Running buildEngineDistribution yields the following warning:

...
[info] Generating index for built-distribution\enso-engine-0.0.0-dev-windows-amd64\enso-0.0.0-dev\lib\Standard\Table
X:\NBO\enso\built-distribution\enso-engine-0.0.0-dev-windows-amd64\enso-0.0.0-dev\lib\Standard\Table\0.0.0-dev\src\Foo.enso:1:1: warning: Duplicated import of naming_helper. The original import is 'from Standard.Table.Column import apply_unary_operation, naming_helper' in Foo.enso[1:1-1:63].
    1 | from project.Column import apply_unary_operation, naming_helper
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Obviously the import is not duplicated - if I comment it out or remove one of the two imported names this results in compiler error, e.g.
changing to

from project.Column import apply_unary_operation

foo = [apply_unary_operation, naming_helper]

yields

X:\NBO\enso\built-distribution\enso-engine-0.0.0-dev-windows-amd64\enso-0.0.0-dev\lib\Standard\Table\0.0.0-dev\src\Foo.enso:3:31: error: The name `naming_helper` could not be found.
    3 | foo = [apply_unary_operation, naming_helper]
      |                               ^~~~~~~~~~~~~
@radeusgd
Copy link
Member Author

Apparently the workaround seems to be to rewrite the imports to

import project.Column.apply_unary_operation
import project.Column.naming_helper

foo = [apply_unary_operation, naming_helper]

and then the warning disappears.

@radeusgd radeusgd added the p-low Low priority label Feb 27, 2025
@radeusgd
Copy link
Member Author

Interestingly, I was trying to create and run a project with similar layout for smaller repro, but couldn't get that warning.

The only combination I've found is the above - adding these 2 imports in the Standard.Table project and compiling it with buildEngineDistribution.

radeusgd added a commit that referenced this issue Feb 27, 2025
radeusgd added a commit that referenced this issue Feb 27, 2025
@jdunkerley jdunkerley moved this from ❓New to 📤 Backlog in Issues Board Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--bug Type: bug -compiler p-low Low priority
Projects
Status: 📤 Backlog
Development

No branches or pull requests

2 participants