hdl.ast: Do not warn on int Enums in Cat.

This aligns with the behavior for plain Enums.
This commit is contained in:
Arusekk 2023-01-22 23:05:54 +01:00 committed by Catherine
parent 58a0c68279
commit de6b69370f
2 changed files with 10 additions and 1 deletions

View file

@ -801,6 +801,15 @@ class CatTestCase(FHDLTestCase):
c = Cat(Color.RED, Color.BLUE)
self.assertEqual(repr(c), "(cat (const 2'd1) (const 2'd2))")
def test_intenum(self):
class Color(int, Enum):
RED = 1
BLUE = 2
with warnings.catch_warnings():
warnings.filterwarnings(action="error", category=SyntaxWarning)
c = Cat(Color.RED, Color.BLUE)
self.assertEqual(repr(c), "(cat (const 2'd1) (const 2'd2))")
def test_int_wrong(self):
with self.assertWarnsRegex(SyntaxWarning,
r"^Argument #1 of Cat\(\) is a bare integer 2 used in bit vector context; "