Skip to content

Commit

Permalink
fix[lang]: fix recursive interface imports (vyperlang#4303)
Browse files Browse the repository at this point in the history
fix a bug where imports inside of interfaces are not recursed into in
the import resolution pass. this is a regression in
6843e79.
  • Loading branch information
charles-cooper authored Oct 14, 2024
1 parent 6843e79 commit a70a024
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/functional/syntax/test_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,22 @@ def test_interfaces_success(good_code):


def test_imports_and_implements_within_interface(make_input_bundle):
interface_code = """
ibar_code = """
@external
def foobar():
...
"""
ifoo_code = """
import bar
input_bundle = make_input_bundle({"foo.vyi": interface_code})
implements: bar
@external
def foobar():
...
"""

input_bundle = make_input_bundle({"foo.vyi": ifoo_code, "bar.vyi": ibar_code})

code = """
import foo as Foo
Expand Down
1 change: 1 addition & 0 deletions vyper/semantics/analysis/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ def _load_import_helper(
file = self.input_bundle.load_file(path.with_suffix(".vyi"))
assert isinstance(file, FileInput) # mypy hint
module_ast = self._ast_from_file(file)
self.resolve_imports(module_ast)

# language does not yet allow recursion for vyi files
# self.resolve_imports(module_ast)
Expand Down

0 comments on commit a70a024

Please sign in to comment.