diff --git a/amaranth/lib/wiring.py b/amaranth/lib/wiring.py index 2a5a50c..0d94201 100644 --- a/amaranth/lib/wiring.py +++ b/amaranth/lib/wiring.py @@ -611,7 +611,7 @@ class PureInterface: attrs = ''.join(f", {name}={value!r}" for name, value in self.__dict__.items() if name != "signature") - return f'' + return f'<{type(self).__name__}: {self.signature}{attrs}>' # To reduce API surface area `FlippedInterface` is made final. This restriction could be lifted diff --git a/tests/test_lib_wiring.py b/tests/test_lib_wiring.py index 105de56..ac6e2f0 100644 --- a/tests/test_lib_wiring.py +++ b/tests/test_lib_wiring.py @@ -671,6 +671,12 @@ class PureInterfaceTestCase(unittest.TestCase): intf = PureInterface(sig, path=("test",)) self.assertEqual(repr(intf), "") + def test_repr_inherit(self): + class CustomInterface(PureInterface): + pass + intf = CustomInterface(Signature({}), path=()) + self.assertRegex(repr(intf), r"^$") + class FlippedInterfaceTestCase(unittest.TestCase): def test_basic(self):