diff --git a/source/analysis/classHierarchyEnvironment.ml b/source/analysis/classHierarchyEnvironment.ml index 2da69592b62..d69bf89f80b 100644 --- a/source/analysis/classHierarchyEnvironment.ml +++ b/source/analysis/classHierarchyEnvironment.ml @@ -82,8 +82,8 @@ let get_parents alias_environment name ~dependency = | _ -> None in let bases ({ Node.value = { ClassSummary.bases = { base_classes; _ }; _ }; _ } as definition) = - let inferred_base = AnnotatedBases.inferred_generic_base definition ~parse_annotation in - inferred_base @ base_classes + let inferred_generic_base = AnnotatedBases.inferred_generic_base definition ~parse_annotation in + base_classes @ inferred_generic_base in let add_special_parents parents = let simples = List.map ~f:(fun parent -> parent, []) in diff --git a/source/analysis/missingFromStubs.ml b/source/analysis/missingFromStubs.ml index a3848daf6d5..7797ee41a34 100644 --- a/source/analysis/missingFromStubs.ml +++ b/source/analysis/missingFromStubs.ml @@ -210,10 +210,10 @@ let missing_builtin_classes = make ~bases: [ + Type.Primitive "typing.Callable"; Type.parametric "typing.Generic" [Single (Type.variable "typing._T"); Single (Type.variable "typing._S")]; - Type.Primitive "typing.Callable"; ] "BoundMethod"; ] diff --git a/source/analysis/test/classHierarchyEnvironmentTest.ml b/source/analysis/test/classHierarchyEnvironmentTest.ml index d8d75c71694..816a972ae8d 100644 --- a/source/analysis/test/classHierarchyEnvironmentTest.ml +++ b/source/analysis/test/classHierarchyEnvironmentTest.ml @@ -161,7 +161,7 @@ let test_inferred_generic_base context = pass |} "test.C" - (Some ["typing.Generic", [Type.variable "test._T"]; "test.List", [Type.variable "test._T"]]); + (Some ["test.List", [Type.variable "test._T"]; "typing.Generic", [Type.variable "test._T"]]); assert_registers {| _T = typing.TypeVar("_T") @@ -183,8 +183,8 @@ let test_inferred_generic_base context = "test.Foo" (Some [ - "typing.Generic", [Type.variable "test._T1"; Type.variable "test._T2"]; "test.Dict", [Type.variable "test._T1"; Type.variable "test._T2"]; + "typing.Generic", [Type.variable "test._T1"; Type.variable "test._T2"]; ]); assert_registers {| @@ -197,8 +197,8 @@ let test_inferred_generic_base context = "test.Foo" (Some [ - "typing.Generic", [Type.variable "test._T1"]; "test.Dict", [Type.variable "test._T1"; Type.variable "test._T1"]; + "typing.Generic", [Type.variable "test._T1"]; ]); () diff --git a/source/test/test.ml b/source/test/test.ml index b87d5175ebf..cb5069e24c1 100644 --- a/source/test/test.ml +++ b/source/test/test.ml @@ -1288,7 +1288,7 @@ let typeshed_stubs ?(include_helper_builtins = true) () = def __len__(self) -> int: ... class Sequence(_Collection[_T_co], Generic[_T_co]): pass - class Generator(Generic[_T_co, _T_contra, _V_co], Iterator[_T_co]): + class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]): pass class AbstractSet(_Collection[_T_co], Generic[_T_co]):