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

@ -860,7 +860,7 @@ class Cat(Value):
super().__init__(src_loc_at=src_loc_at)
self.parts = []
for index, arg in enumerate(flatten(args)):
if isinstance(arg, int) and arg not in [0, 1]:
if isinstance(arg, int) and not isinstance(arg, Enum) and arg not in [0, 1]:
warnings.warn("Argument #{} of Cat() is a bare integer {} used in bit vector "
"context; consider specifying explicit width using C({}, {}) instead"
.format(index + 1, arg, arg, bits_for(arg)),