Skip to content

Commit

Permalink
simplify a test
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Mar 19, 2024
1 parent 039e5f4 commit 6dfd08d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/functional/codegen/modules/test_flag_imports.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
def test_import_flag_types(make_input_bundle, get_contract):
lib1 = """
import lib2
import lib2
flag Roles:
ADMIN
Expand Down
7 changes: 1 addition & 6 deletions vyper/codegen/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,7 @@ def parse_Attribute(self):
typ = self.expr._metadata["type"]

# (lib1).MyFlag.foo
if isinstance(typ, FlagT) and (
(isinstance(self.expr.value, vy_ast.Name)
and typ.name == self.expr.value.id)
or (isinstance(self.expr.value, vy_ast.Attribute)
and typ.name == self.expr.value.attr)
):
if isinstance(typ, FlagT) and is_type_t(self.expr.value._metadata["type"], FlagT):
# 0, 1, 2, .. 255
flag_id = typ._flag_members[self.expr.attr]
value = 2**flag_id # 0 => 0001, 1 => 0010, 2 => 0100, etc.
Expand Down

0 comments on commit 6dfd08d

Please sign in to comment.