hdl.ast: Do not warn on int Enums in Cat.
This aligns with the behavior for plain Enums.
This commit is contained in:
parent
58a0c68279
commit
de6b69370f
2 changed files with 10 additions and 1 deletions
|
|
@ -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; "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue