Skip to content

Commit

Permalink
fix[venom]: add unique_symbols check to venom pipeline (#4149)
Browse files Browse the repository at this point in the history
when `-Onone` is specified along with `--experimental-codegen`,
the unique symbols check does not get run. this calculates the
`ir_node.unique_symbols` property, which implicitly runs the unique
symbols check.

also, change an assertion to a proper panic exception
  • Loading branch information
charles-cooper committed Jun 17, 2024
1 parent c79c0b6 commit a72488c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vyper/codegen/ir_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ def unique_symbols(self):
for arg in children:
s = arg.unique_symbols
non_uniques = ret.intersection(s)
assert len(non_uniques) == 0, f"non-unique symbols {non_uniques}"
if len(non_uniques) != 0: # pragma: nocover
raise CompilerPanic(f"non-unique symbols {non_uniques}")
ret |= s
return ret

Expand Down
2 changes: 2 additions & 0 deletions vyper/venom/ir_node_to_venom.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@

# convert IRnode directly to venom
def ir_node_to_venom(ir: IRnode) -> IRContext:
_ = ir.unique_symbols # run unique symbols check

global _global_symbols, _external_functions
_global_symbols = {}
_external_functions = {}
Expand Down

0 comments on commit a72488c

Please sign in to comment.