Skip to content

Commit a70a024

Browse files
fix[lang]: fix recursive interface imports (vyperlang#4303)
fix a bug where imports inside of interfaces are not recursed into in the import resolution pass. this is a regression in 6843e79.
1 parent 6843e79 commit a70a024

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

tests/functional/syntax/test_interfaces.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,22 @@ def test_interfaces_success(good_code):
381381

382382

383383
def test_imports_and_implements_within_interface(make_input_bundle):
384-
interface_code = """
384+
ibar_code = """
385385
@external
386386
def foobar():
387387
...
388388
"""
389+
ifoo_code = """
390+
import bar
389391
390-
input_bundle = make_input_bundle({"foo.vyi": interface_code})
392+
implements: bar
393+
394+
@external
395+
def foobar():
396+
...
397+
"""
398+
399+
input_bundle = make_input_bundle({"foo.vyi": ifoo_code, "bar.vyi": ibar_code})
391400

392401
code = """
393402
import foo as Foo

vyper/semantics/analysis/imports.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ def _load_import_helper(
194194
file = self.input_bundle.load_file(path.with_suffix(".vyi"))
195195
assert isinstance(file, FileInput) # mypy hint
196196
module_ast = self._ast_from_file(file)
197+
self.resolve_imports(module_ast)
197198

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

0 commit comments

Comments
 (0)