Visitar URL original
Prevent endless recursion if typedef generates same name · MeVisLab/pythonqt@c154075 · GitHub
Skip to content

Commit c154075

Browse files
committed
Prevent endless recursion if typedef generates same name
Probably happened for template types, which are not handled well by this code model.
1 parent e6abebd commit c154075

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎generator/parser/codemodel.cpp‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,13 @@ TypeInfo TypeInfo::resolveType(TypeInfo const& __type, CodeModelItem __scope)
156156
otherType.setQualifiedName(__item->qualifiedName());
157157
}
158158

159-
if (TypeAliasModelItem __alias = __item.dynamicCast<_TypeAliasModelItem>())
160-
return resolveType(TypeInfo::combine(__alias->type(), otherType), __scope);
159+
if (TypeAliasModelItem __alias = __item.dynamicCast<_TypeAliasModelItem>()) {
160+
TypeInfo updatedTypeInfo = TypeInfo::combine(__alias->type(), otherType);
161+
// avoid endless recursion on trivial identity (because this model doesn't, e.g., handle templates)
162+
if (updatedTypeInfo != __type) {
163+
return resolveType(updatedTypeInfo, __scope);
164+
}
165+
}
161166

162167
return otherType;
163168
}

0 commit comments

Comments
 (0)