Skip to content

Commit

Permalink
fix: failed type check
Browse files Browse the repository at this point in the history
  • Loading branch information
changhoetyng committed Sep 24, 2024
1 parent b0d9fe5 commit 9b3fe05
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -6415,21 +6415,20 @@ def lookup_fully_qualified_or_none(self, fullname: str) -> SymbolTableNode | Non
if module not in self.modules:
# Check if there's nested module A.B.C
splitted = fullname.rsplit(".")
module, name = splitted[0], splitted[1:]
module, names = splitted[0], splitted[1:]
# If module still not in modules, return None
if module not in self.modules:
return None
filenode = self.modules[module]
result = filenode.names.get(name[0])
result = filenode.names.get(names[0])

if result is None and self.is_incomplete_namespace(module):
# TODO: More explicit handling of incomplete refs?
self.record_incomplete_ref()

for part in name[1:]:
for part in names[1:]:
if result is not None and isinstance(result.node, TypeInfo):
filenode = result.node
result = filenode.names.get(part)
result = result.node.names.get(part)
else:
return None
return result
Expand Down

0 comments on commit 9b3fe05

Please sign in to comment.