diff --git a/jedi/evaluate/base_context.py b/jedi/evaluate/base_context.py index fbf37722..6c683469 100644 --- a/jedi/evaluate/base_context.py +++ b/jedi/evaluate/base_context.py @@ -32,6 +32,9 @@ class HelperContextMixin: def execute_annotation(self): return self.execute_evaluated() + def gather_annotation_classes(self): + return ContextSet([self]) + def merge_types_of_iterate(self, contextualized_node=None, is_async=False): return ContextSet.from_sets( lazy_context.infer() @@ -353,6 +356,9 @@ class ContextSet(BaseContextSet): context_set |= method() return context_set + def gather_annotation_classes(self): + return ContextSet.from_sets([c.gather_annotation_classes() for c in self._set]) + def get_signatures(self): return [sig for c in self._set for sig in c.get_signatures()] diff --git a/jedi/evaluate/context/typing.py b/jedi/evaluate/context/typing.py index 59a22b49..5c2df354 100644 --- a/jedi/evaluate/context/typing.py +++ b/jedi/evaluate/context/typing.py @@ -180,6 +180,11 @@ class TypingContextWithIndex(_WithIndexBase): self._context_of_index )]) + def gather_annotation_classes(self): + return ContextSet.from_sets( + _iter_over_arguments(self._index_context, self._context_of_index) + ) + class TypingContext(_BaseTypingContext): index_class = TypingContextWithIndex diff --git a/jedi/evaluate/param.py b/jedi/evaluate/param.py index cadfedb7..cff87d29 100644 --- a/jedi/evaluate/param.py +++ b/jedi/evaluate/param.py @@ -52,7 +52,7 @@ class ExecutedParam(object): return True matches = any(c1.is_sub_class_of(c2) for c1 in argument_contexts - for c2 in annotations) + for c2 in annotations.gather_annotation_classes()) debug.dbg("signature compare %s: %s <=> %s", matches, argument_contexts, annotations, color='BLUE') return matches diff --git a/jedi/third_party/typeshed b/jedi/third_party/typeshed index cd1fbb0e..35ef15d8 160000 --- a/jedi/third_party/typeshed +++ b/jedi/third_party/typeshed @@ -1 +1 @@ -Subproject commit cd1fbb0e9fa5a0cc1ac5d1907434257b01082b86 +Subproject commit 35ef15d863e043ea6562aba4a23450bcdd823781