fastai / nbdev

Create delightful software with Jupyter Notebooks
https://nbdev.fast.ai/
Apache License 2.0
4.8k stars 484 forks source link

No documentation rendered for return type when function has no arguments #1386

Open lukastk opened 7 months ago

lukastk commented 7 months ago

No documentation is rendered for the return type, if the function has no arguments. Compare the two functions defined below:

#|export
def foo1(
        ) -> int: # Return type documentation
    """Docstring"""
    return 1

#|export
def foo2(
        a, # test
        ) -> int: # Return type documentation
    """Docstring"""
    return 1

The following documentation is rendered, after running nbdev_docs:

image

You can see that the return type is missing documentation in foo1.

You can find the reproduced bug in this repository:

https://github.com/lukastk/nbdev_method_doc_test