diff --git a/jedi/parsing_representation.py b/jedi/parsing_representation.py index 3b341b1b..5f9b988f 100644 --- a/jedi/parsing_representation.py +++ b/jedi/parsing_representation.py @@ -1059,6 +1059,8 @@ class Statement(Simple): lambd, tok = parse_lambda(token_iterator) if lambd is not None: result.append(lambd) + else: + continue is_literal = token_type in [tokenize.STRING, tokenize.NUMBER] if isinstance(tok, Name) or is_literal: diff --git a/test/test_integration_keyword.py b/test/test_integration_keyword.py index 13421baf..5c0dbcc3 100644 --- a/test/test_integration_keyword.py +++ b/test/test_integration_keyword.py @@ -40,3 +40,7 @@ def test_keyword(): with common.ignored(jedi.NotFoundError): # TODO shouldn't throw that. defs = Script("assert").goto_definitions() assert len(defs) == 1 + +def test_lambda(): + defs = Script('lambda x: x', column=0).goto_definitions() + assert [d.type for d in defs] == ['keyword']