Skip to content

Commit 7aa37cd

Browse files
author
hauntsaninja
committed
mypyc shot in the dark pt 2
1 parent 6eedcc4 commit 7aa37cd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

mypy/semanal.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4788,7 +4788,7 @@ def add_imported_symbol(self,
47884788
assert not module_hidden or not module_public
47894789

47904790
symbol_node: Optional[SymbolNode] = node.node
4791-
if self.is_class_scope() and isinstance(symbol_node, (FuncBase, Var)):
4791+
if self.is_class_scope() and isinstance(symbol_node, (Var, FuncBase)):
47924792
# We construct a new node to represent this symbol and set its `info` attribute
47934793
# to `self.type`. Note that imports inside class scope do not produce methods, so
47944794
# in all cases constructing a Var gets us the assignment like behaviour we want.
@@ -4802,7 +4802,12 @@ def add_imported_symbol(self,
48024802
# constructed Var, so check for possible redefinitions here.
48034803
symbol_node = existing.node
48044804
else:
4805-
symbol_node = Var(symbol_node.name, symbol_node.type)
4805+
# Dumb if statement to appease mypyc
4806+
if isinstance(symbol_node, Var):
4807+
symbol_node = Var(symbol_node.name, symbol_node.type)
4808+
else:
4809+
symbol_node = Var(symbol_node.name, symbol_node.type)
4810+
48064811
assert self.type is not None
48074812
symbol_node.info = self.type
48084813
symbol_node._fullname = self.qualified_name(name)

0 commit comments

Comments
 (0)