You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have x = Signal(decoder=Foo) and try to do x.match(Bar.QUUX) or m.Switch(x)/m.Case(Bar.QUUX), there should be an exception (TypeError?) thrown to catch any potential bugs where an enum of the wrong type is being used.
The text was updated successfully, but these errors were encountered:
We can do this on a best-effort basis with a lint (warning by default diagnostic), but Amaranth is an untyped language (in that all values belong to the same type and are mutually interoperable regardless of how they're constructed) and it is not feasible to add a type system to it even if it was desired.
whitequark
changed the title
Catch matching on an enum of the wrong type
Emit a warning when matching a signal with an enum decoder with enum values of wrong type
Jan 31, 2023
If you have
x = Signal(decoder=Foo)
and try to dox.match(Bar.QUUX)
orm.Switch(x)
/m.Case(Bar.QUUX)
, there should be an exception (TypeError
?) thrown to catch any potential bugs where an enum of the wrong type is being used.The text was updated successfully, but these errors were encountered: