diff --git a/jedi/inference/gradual/annotation.py b/jedi/inference/gradual/annotation.py index 257de6e5..cfde9f0f 100644 --- a/jedi/inference/gradual/annotation.py +++ b/jedi/inference/gradual/annotation.py @@ -91,7 +91,7 @@ def _split_comment_param_declaration(decl_text): debug.warning('Comment annotation is not valid Python: %s' % decl_text) return [] - if node.type == 'name': + if node.type in ['name', 'atom_expr', 'power']: return [node.get_code().strip()] params = [] diff --git a/test/completion/pep0484_comments.py b/test/completion/pep0484_comments.py index 9f0661ec..902d1a15 100644 --- a/test/completion/pep0484_comments.py +++ b/test/completion/pep0484_comments.py @@ -38,6 +38,20 @@ def test(a, b): #? str() e +class AA: + class BB: + pass + +def test(a): + # type: (AA.BB) -> None + #? AA.BB() + a + +def test(a): + # type: (AA.BB,) -> None + #? AA.BB() + a + a,b = 1, 2 # type: str, float #? str() a