diff --git a/jedi/inference/syntax_tree.py b/jedi/inference/syntax_tree.py index a4f3e1210..294fb7e4c 100644 --- a/jedi/inference/syntax_tree.py +++ b/jedi/inference/syntax_tree.py @@ -493,8 +493,10 @@ def infer_factor(value_set, operator): elif operator == 'not': b = value.py__bool__() if b is None: # Uncertainty. - return - yield compiled.create_simple_object(value.inference_state, not b) + yield list(value.inference_state.builtins_module.py__getattribute__('bool') + .execute_annotation()).pop() + else: + yield compiled.create_simple_object(value.inference_state, not b) else: yield value @@ -645,10 +647,7 @@ def _infer_comparison_part(inference_state, context, left, operator, right): _bool_to_value(inference_state, False) ]) elif str_operator in ('in', 'not in'): - return ValueSet([ - _bool_to_value(inference_state, True), - _bool_to_value(inference_state, False) - ]) + return inference_state.builtins_module.py__getattribute__('bool').execute_annotation() def check(obj): """Checks if a Jedi object is either a float or an int.""" diff --git a/test/completion/basic.py b/test/completion/basic.py index 3c0448e59..2894b0e89 100644 --- a/test/completion/basic.py +++ b/test/completion/basic.py @@ -431,3 +431,6 @@ def __enter__(self): #? bool() res = 'f' in 'foo'; res + +#? bool() +res = not {}; res