diff --git a/python/src/com/jetbrains/python/documentation/docstrings/PyDocstringGenerator.java b/python/src/com/jetbrains/python/documentation/docstrings/PyDocstringGenerator.java index 247d8ebf731a..9f32cd3091ca 100644 --- a/python/src/com/jetbrains/python/documentation/docstrings/PyDocstringGenerator.java +++ b/python/src/com/jetbrains/python/documentation/docstrings/PyDocstringGenerator.java @@ -441,8 +441,8 @@ public class PyDocstringGenerator { sectionBuilder.startReturnsSection(); boolean hasTypedReturns = false; for (DocstringParam returnValue : returnValues) { - if (returnValue.getType() != null) { - sectionBuilder.addReturnValue(null, getDefaultType(returnValue), ""); + if (StringUtil.isNotEmpty(returnValue.getType())) { + sectionBuilder.addReturnValue(null, returnValue.getType(), ""); hasTypedReturns = true; } } diff --git a/python/testData/intentions/afterGoogleDocStubWithTypes.py b/python/testData/intentions/afterGoogleDocStubWithTypes.py index c961ab9ef68a..d98dffbfa73b 100644 --- a/python/testData/intentions/afterGoogleDocStubWithTypes.py +++ b/python/testData/intentions/afterGoogleDocStubWithTypes.py @@ -6,6 +6,6 @@ def f(x, y): y (): Returns: - object: + """ return 42 \ No newline at end of file diff --git a/python/testData/intentions/afterNumpyDocStubWithTypes.py b/python/testData/intentions/afterNumpyDocStubWithTypes.py index 025c246fed0e..1b9e2fcb6763 100644 --- a/python/testData/intentions/afterNumpyDocStubWithTypes.py +++ b/python/testData/intentions/afterNumpyDocStubWithTypes.py @@ -8,6 +8,6 @@ def f(x, y): Returns ------- - object + """ return 42 \ No newline at end of file