From fe50352f9cb3b6bbb1abd4243e257c3863c36af3 Mon Sep 17 00:00:00 2001 From: Laurent Soest Date: Sat, 28 Aug 2021 20:53:54 +0200 Subject: [PATCH] annotations should be preferred even when it is a generator --- jedi/inference/value/function.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jedi/inference/value/function.py b/jedi/inference/value/function.py index 2471a065..a89e9c88 100644 --- a/jedi/inference/value/function.py +++ b/jedi/inference/value/function.py @@ -344,7 +344,8 @@ class BaseFunctionExecutionContext(ValueContext, TreeContextMixin): GenericClass(c, TupleGenericManager(generics)) for c in async_classes ).execute_annotation() else: - if self.is_generator(): + # If there are annotations, prefer them over anything else. + if self.is_generator() and not self.infer_annotations(): return ValueSet([iterable.Generator(inference_state, self)]) else: return self.get_return_values()