From cae8a2ffcc71133a5b2c41a384b0d7a011736b21 Mon Sep 17 00:00:00 2001 From: benber86 Date: Thu, 5 Jan 2023 00:10:04 +1100 Subject: [PATCH] Check for 'self' in namespace to get proper exception --- vyper/semantics/analysis/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vyper/semantics/analysis/utils.py b/vyper/semantics/analysis/utils.py index 1e1e0f95b3..b70c2c0270 100644 --- a/vyper/semantics/analysis/utils.py +++ b/vyper/semantics/analysis/utils.py @@ -307,7 +307,11 @@ def types_from_List(self, node): def types_from_Name(self, node): # variable name, e.g. `foo` name = node.id - if name not in self.namespace and name in self.namespace["self"].typ.members: + if ( + name not in self.namespace + and "self" in self.namespace + and name in self.namespace["self"].typ.members + ): raise InvalidReference( f"'{name}' is a storage variable, access it as self.{name}", node )