diff --git a/tests/functional/syntax/test_interfaces.py b/tests/functional/syntax/test_interfaces.py index baf0c73c30..ecd4ef6b91 100644 --- a/tests/functional/syntax/test_interfaces.py +++ b/tests/functional/syntax/test_interfaces.py @@ -621,3 +621,31 @@ def bar(): # TODO make the exception more precise once fixed with pytest.raises(Exception): # noqa: B017 compiler.compile_code(main, input_bundle=input_bundle) + + +def test_interface_name_in_signature_is_short(make_input_bundle): + foo = """ +from ethereum.ercs import IERC20 + +def foobar(token: IERC20): + ... + """ + code = """ +from ethereum.ercs import IERC20 +import foo as Foo +implements: Foo + +@internal +def foobar(token: IERC20): + pass + """ + + input_bundle = make_input_bundle({"foo.vyi": foo}) + + with pytest.raises(InterfaceViolation) as e: + compiler.compile_code(code, input_bundle=input_bundle) + + assert ( + e.value.message + == "Contract does not implement all interface functions: foobar(IERC20)" + ) diff --git a/vyper/semantics/types/function.py b/vyper/semantics/types/function.py index ffeb5b7299..0a5d0d354d 100644 --- a/vyper/semantics/types/function.py +++ b/vyper/semantics/types/function.py @@ -209,7 +209,7 @@ def __str__(self): @cached_property def _pp_signature(self): - ret = ",".join(repr(arg.typ) for arg in self.arguments) + ret = ",".join(str(arg.typ) for arg in self.arguments) return f"{self.name}({ret})" # override parent implementation. function type equality does not diff --git a/vyper/semantics/types/module.py b/vyper/semantics/types/module.py index 498757b94e..29ff0d8d2c 100644 --- a/vyper/semantics/types/module.py +++ b/vyper/semantics/types/module.py @@ -1,4 +1,5 @@ from functools import cached_property +from pathlib import Path from typing import TYPE_CHECKING, Optional from vyper import ast as vy_ast @@ -79,7 +80,7 @@ def abi_type(self) -> ABIType: return ABI_Address() def __str__(self): - return self._id + return Path(self._id).stem def __repr__(self): return f"interface {self._id}"