hdl.ast: Value.matches() with no arguments should return C(1).

The behavior of the following must be always the same:
- `with m.Switch(v): with m.Case(*pats):`
- `with m.If(v.matches(*pats)):`
This commit is contained in:
Catherine 2023-02-28 09:09:27 +00:00
parent 9aeb22311f
commit ef2e9fa809
3 changed files with 3 additions and 2 deletions

View file

@ -442,7 +442,7 @@ class Value(metaclass=ABCMeta):
continue
matches.append(self == pattern)
if not matches:
return Const(0)
return Const(1)
elif len(matches) == 1:
return matches[0]
else: