From a72488ce68125a65813199f9b1188ce60a987feb Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Mon, 17 Jun 2024 14:23:30 -0700 Subject: [PATCH] fix[venom]: add `unique_symbols` check to venom pipeline (#4149) 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 --- vyper/codegen/ir_node.py | 3 ++- vyper/venom/ir_node_to_venom.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/vyper/codegen/ir_node.py b/vyper/codegen/ir_node.py index 9d39ebd033..97d9c45fb6 100644 --- a/vyper/codegen/ir_node.py +++ b/vyper/codegen/ir_node.py @@ -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 diff --git a/vyper/venom/ir_node_to_venom.py b/vyper/venom/ir_node_to_venom.py index 4fca95be90..85172c70e1 100644 --- a/vyper/venom/ir_node_to_venom.py +++ b/vyper/venom/ir_node_to_venom.py @@ -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 = {}