PY-18733 Consider return type collected by debugger in generated docstrings

Don't add empty type annotation for return value inside generated
docstring unconditionally in PyDocstringGenerator. It should really be
found in PyDocstringGenerator#prepareParameters().
This commit is contained in:
Mikhail Golubev
2016-03-10 12:39:49 +03:00
parent b2587b951a
commit 7ba4efa774
@@ -209,10 +209,7 @@ public class PyDocstringGenerator {
statementList.accept(visitor);
if (!isConstructor((PyFunction)myDocStringOwner) && (visitor.myHasReturn || addReturn)) {
// will add :return: placeholder in Sphinx/Epydoc docstrings
myAddedParams.add(new DocstringParam("", null, true));
if (PyCodeInsightSettings.getInstance().INSERT_TYPE_DOCSTUB) {
withReturnValue("");
}
withReturnValue(null);
}
}
return this;
@@ -274,7 +271,8 @@ public class PyDocstringGenerator {
String type = paramTypes.get(paramCoordinates);
if (type == null && PyCodeInsightSettings.getInstance().INSERT_TYPE_DOCSTUB) {
if (signature != null) {
type = StringUtil.notNullize(param.isReturnValue() ? signature.getReturnTypeQualifiedName() :
type = StringUtil.notNullize(param.isReturnValue() ?
signature.getReturnTypeQualifiedName() :
signature.getArgTypeQualifiedName(param.getName()));
}
else {