hdl.rec: proxy operators correctly.
authorawygle <awygle@gmail.com>
Mon, 9 Nov 2020 20:20:25 +0000 (12:20 -0800)
committerGitHub <noreply@github.com>
Mon, 9 Nov 2020 20:20:25 +0000 (20:20 +0000)
commitea94c9cc45c1c6d47673160a4c6edcfa9e37141d
treedb88e1f061ff7eb2ed570ca89f4eac36750c6fe4
parentebbdac97987cb91e2418e80e2416c3a81f1dabdc
hdl.rec: proxy operators correctly.

Commit abbebf8e used __getattr__ to proxy Value methods called on
Record. However, that did not proxy operators like __add__ because
Python looks up the special operator methods directly on the class
and does not run __getattr__ if they are missing.

Instead of using __getattr__, explicitly enumerate and wrap every
Value method that should be proxied. This also ensures backwards
compatibility if more methods are added to Value later.

Fixes #533.
nmigen/hdl/rec.py
tests/test_hdl_rec.py