hdl.dsl: error on Elif immediately nested in an If.
I.e. on this code, which is currently not only wrongly accepted but
also results in completely unexpected RTL:
with m.If(...):
with m.Elif(...):
...
Fixes #500.
This commit is contained in:
parent
2c505deacc
commit
9d62cbefa5
2 changed files with 9 additions and 1 deletions
|
|
@ -266,6 +266,14 @@ class DSLTestCase(FHDLTestCase):
|
|||
with m.Elif(self.s2):
|
||||
pass
|
||||
|
||||
def test_Elif_wrong_nested(self):
|
||||
m = Module()
|
||||
with m.If(self.s1):
|
||||
with self.assertRaisesRegex(SyntaxError,
|
||||
r"^Elif without preceding If$"):
|
||||
with m.Elif(self.s2):
|
||||
pass
|
||||
|
||||
def test_Else_wrong(self):
|
||||
m = Module()
|
||||
with self.assertRaisesRegex(SyntaxError,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue