diff --git a/mypy/checker.py b/mypy/checker.py index f90fc4be41f4..96e41a5e1786 100644 --- a/mypy/checker.py +++ b/mypy/checker.py @@ -5968,7 +5968,7 @@ def _make_fake_typeinfo_and_full_name( errors.append((pretty_names_list, "would have incompatible method signatures")) return None - curr_module.names[full_name] = SymbolTableNode(GDEF, info) + curr_module.names[full_name] = SymbolTableNode(GDEF, info, False, module_hidden=True) return Instance(info, [], extra_attrs=instances[0].extra_attrs or instances[1].extra_attrs) def intersect_instance_callable(self, typ: Instance, callable_type: CallableType) -> Instance: diff --git a/test-data/unit/check-modules.test b/test-data/unit/check-modules.test index 8faacb1a95f8..fd81765f5624 100644 --- a/test-data/unit/check-modules.test +++ b/test-data/unit/check-modules.test @@ -593,6 +593,25 @@ x = 1 [file m2.py] x = 1 +[case testStarImportDoesNotImportGeneratedIntersections] +from m1 import * +from m2 import * +[file m1.py] +from m3 import A, B + +a: A +if isinstance(a, B): ... +[file m2.py] +from m3 import A, B + +a: A +if isinstance(a, B): ... +[file m3.py] +class A: ... +class B: ... +class AB(A, B): ... +[builtins fixtures/isinstance.pyi] + [case testAssignToFuncDefViaImport] # Errors differ with the new analyzer. (Old analyzer gave error on the