Skip to content

Commit

Permalink
If an import resolves to an unresolvable alias, then use the alias fu…
Browse files Browse the repository at this point in the history
…llName
  • Loading branch information
tristanlatr committed Apr 4, 2024
1 parent c2df1e8 commit e5558de
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pydoctor/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ def _resolveImport(ctx: model.CanContainImportsDocumentable, import_:_Indirectio
resolved = _localDocumentableToFullName(ctx, allobjects[fullName], indirections)
if resolved:
return resolved
else:
return allobjects[fullName].fullName()


dottedName = fullName.split('.')
parentName, targetName = '.'.join(dottedName[0:-1]), dottedName[-1]
Expand Down Expand Up @@ -141,7 +144,7 @@ def _resolveAlias(self: model.CanContainImportsDocumentable, alias: _Indirection
# We try with the parent scope.
# This is used in situations like right here in the System class and it's aliases (before version > 22.5.1),
# because they have the same name as the name they are aliasing, the alias resolves to the same object.
# We could use astuce here to be more precise (better static analysis) and make this code more simple and less error-prone.
# We could use better static analysis and make this code more simple and less error-prone.
return parent.expandName(name, indirections=indirections + [alias])

self.module.report("Failed to resolve alias (found same alias again)", lineno_offset=alias.linenumber, section='aliases')
Expand Down

0 comments on commit e5558de

Please sign in to comment.