Skip to content

Commit

Permalink
lib.io: add a deprecation warning on Pin.eq.
Browse files Browse the repository at this point in the history
This will stop working once `Pin` is no longer inheriting from
`Record`.
  • Loading branch information
whitequark committed Sep 5, 2023
1 parent 1d3a620 commit a9d0380
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions amaranth/lib/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,9 @@ def __init__(self, width, dir, *, xdr=0, name=None, src_loc_at=0):
@property
def signature(self):
return _pin_signature(self.width, self.dir, self.xdr)

def eq(self, other):
first_field, _, _ = next(iter(Pin(1, dir="o").layout))
warnings.warn(f"`pin.eq(...)` is deprecated; use `pin.{first_field}.eq(...)` here",
DeprecationWarning, stacklevel=2)
return super().eq(other)

0 comments on commit a9d0380

Please sign in to comment.