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

Imprecise Duplicate Import Check #3993

Open
cyberthirst opened this issue May 2, 2024 · 0 comments
Open

Imprecise Duplicate Import Check #3993

cyberthirst opened this issue May 2, 2024 · 0 comments
Labels
bug - typechecker issue with typechecker

Comments

@cyberthirst
Copy link
Collaborator

Version Information

  • vyper Version (output of vyper --version): commit 4b4e188

Issue description

In ModuleAnalyzer._load_import_helper(), the following check ensures
that a given file is not imported multiple times:

if path in self._imported_modules:
    previous_import_stmt = self._imported_modules[path]
    raise DuplicateImport(f"{alias} imported more than once!", previous_import_stmt, node)

However, the check is not performed using a normalized path as it is
being done in the input bundle. This means that for a lib1 in the
directory project, it can be bypassed as follows:

import lib1
from ..project import lib1 as lib2

Note however that since paths are normalized in the input bundle, if the
two modules are initialized, for example, the compiler will raise an
exception.

credits: @trocher

@charles-cooper charles-cooper added the bug - typechecker issue with typechecker label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug - typechecker issue with typechecker
Projects
None yet
Development

No branches or pull requests

2 participants