diff --git a/documentation/python.py b/documentation/python.py index 64d1a46f..9717e039 100755 --- a/documentation/python.py +++ b/documentation/python.py @@ -1191,10 +1191,14 @@ def extract_annotation(state: State, referrer_path: List[str], annotation) -> Tu elif isinstance(annotation, typing.TypeVar): return annotation.__name__, annotation.__name__ - # Ellipsis -- print a literal `...` - # TODO: any chance to link this to python official docs? + # Ellipsis -- print a literal `...`, link to Ellipsis in python docs elif annotation is ...: - return '...', '...' + # TODO m.sphinx needs to have a special case to extract `...` from + # python.inv (which is a `std.term`, alongside generic stuff like + # "class", "py" etc. which we DON'T want to link to) and convert it to + # a link to Ellipsis, or alternatively pass Ellipsis here but make it + # display as a literal ... + return '...', make_name_link(state, referrer_path, 'Ellipsis') # If the annotation is from the typing module, it ... gets complicated. It # could be a "bracketed" type, in which case we want to recurse to its diff --git a/documentation/test_python/inspect_type_links/inspect_type_links/second.py b/documentation/test_python/inspect_type_links/inspect_type_links/second.py index 363d2b39..db149e93 100644 --- a/documentation/test_python/inspect_type_links/inspect_type_links/second.py +++ b/documentation/test_python/inspect_type_links/inspect_type_links/second.py @@ -65,6 +65,9 @@ def type_string(a: 'Foo'): def type_nested(a: Tuple[Foo, List[Enum], Any]): """A function with nested type annotation""" +def type_nested_ellipsis(a: Tuple[int, ...]): + """A function with a variadic tuple annotation""" + def type_string_nested(a: 'Tuple[Foo, List[Enum], Any]'): """A function with string nested type annotation"""