Skip to content

Commit

Permalink
Merge branch 'master' into fix/returndatasize-check
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Jun 13, 2024
2 parents 7c458dd + e9e9d78 commit e6da2ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions tests/functional/syntax/modules/test_initializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ def foo():
assert e.value._hint == "add `lib3 := lib3` to its initializer list"


def test_hint_for_missing_initializer_when_no_import(make_input_bundle):
def test_hint_for_missing_initializer_when_no_import(make_input_bundle, chdir_tmp_path):
lib1 = """
counter: uint256
"""
Expand All @@ -1297,7 +1297,8 @@ def foo():
with pytest.raises(InitializerException) as e:
compile_code(main, input_bundle=input_bundle)
assert e.value._message == "`lib2` uses `lib1`, but it is not initialized with `lib1`"
assert e.value._hint == "try importing lib1 first"
hint = "try importing `lib1` first (located at `lib1.vy`)"
assert e.value._hint == hint


@pytest.fixture
Expand Down
3 changes: 2 additions & 1 deletion vyper/semantics/analysis/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,8 @@ def visit_InitializesDecl(self, node):
break

if rhs is None:
hint = f"try importing {item.alias} first"
hint = f"try importing `{item.alias}` first "
hint += f"(located at `{item.module_t._module.path}`)"
elif not isinstance(annotation, vy_ast.Subscript):
# it's `initializes: foo` instead of `initializes: foo[...]`
hint = f"did you mean {module_ref.id}[{lhs} := {rhs}]?"
Expand Down

0 comments on commit e6da2ae

Please sign in to comment.