Skip to content

[red-knot] Add initial support for * imports #16923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Mar 24, 2025
Merged

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Mar 22, 2025

Summary

This PR adds initial support for * imports to red-knot. The approach is to implement a standalone query, called from semantic indexing, that visits the module referenced by the * import and collects all global-scope public names that will be imported by the * import. The SemanticIndexBuilder then adds separate definitions for each of these names, all keyed to the same ast::Alias node that represents the * import.

There are many pieces of *-import semantics that are still yet to be done, even with this PR:

  • This PR does not attempt to implement any of the semantics to do with __all__. (If a module defines __all__, then only the symbols included in __all__ are imported, not all public global-scope symbols.

  • With the logic implemented in this PR as it currently stands, we sometimes incorrectly consider a symbol bound even though it is defined in a branch that is statically known to be dead code, e.g. (assuming the target Python version is set to 3.11):

    # a.py
    
    import sys
    
    if sys.version_info < (3, 10):
        class Foo: ...
    # b.py
    
    from a import *
    
    print(Foo)  # this is unbound at runtime on 3.11,
                # but we currently consider it bound with the logic in this PR

Implementing these features is important, but is for now deferred to followup PRs.

Many thanks to @ntBre, who contributed to this PR in a pairing session on Friday!

Test Plan

Assertions in existing mdtests are adjusted, and several new ones are added.

TODO: the collections.abc integration test at the bottom of star.md is still failing. Not sure why... (I figured out the bug here and fixed it!)

@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label Mar 22, 2025
@AlexWaygood AlexWaygood force-pushed the alex/star-imports-redux branch from 829b35c to d87cd7c Compare March 22, 2025 22:56
Copy link
Contributor

github-actions bot commented Mar 22, 2025

mypy_primer results

Changes were detected when running on open source projects
packaging (https://github.com/pypa/packaging)
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/packaging/src/packaging/_elffile.py:92:16: Type `<module 'struct'>` has no attribute `unpack`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/packaging/src/packaging/_elffile.py:92:48: Type `<module 'struct'>` has no attribute `calcsize`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/packaging/tasks/paths.py:7:11: Type `<module 'os.path'>` has no attribute `abspath`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/packaging/tasks/paths.py:7:27: Type `<module 'os.path'>` has no attribute `dirname`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/packaging/tasks/paths.py:7:43: Type `<module 'os.path'>` has no attribute `dirname`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/packaging/tasks/paths.py:9:9: Type `<module 'os.path'>` has no attribute `join`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/packaging/tests/test_elffile.py:97:19: Type `<module 'struct'>` has no attribute `unpack`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/packaging/tests/test_elffile.py:98:28: Type `<module 'struct'>` has no attribute `pack`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/packaging/tasks/check.py:28:18: Type `<module 'os.path'>` has no attribute `join`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/packaging/tasks/check.py:51:21: Type `<module 'os.path'>` has no attribute `dirname`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/packaging/src/packaging/tags.py:39:23: Type `<module 'struct'>` has no attribute `calcsize`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/packaging/tests/test_tags.py:811:44: Type `<module 'collections.abc'>` has no attribute `Iterator`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/packaging/tests/test_tags.py:1075:44: Type `<module 'collections.abc'>` has no attribute `Iterator`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/packaging/tests/test_tags.py:1278:44: Type `<module 'collections.abc'>` has no attribute `Iterator`
- Found 137 diagnostics
+ Found 123 diagnostics

zipp (https://github.com/jaraco/zipp)
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/zipp/zipp/__init__.py:419:16: Type `<module 'stat'>` has no attribute `S_ISLNK`
- Found 10 diagnostics
+ Found 9 diagnostics

pyinstrument (https://github.com/joerick/pyinstrument)
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pyinstrument/test/low_level/test_context.py:48:19: Object of type `Literal[busy_wait]` cannot be assigned to parameter 2 (`callable`) of bound method `run`; expected type `(...) -> Unknown`
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pyinstrument/test/low_level/test_context.py:49:19: Object of type `Literal[busy_wait]` cannot be assigned to parameter 2 (`callable`) of bound method `run`; expected type `(...) -> Unknown`
+ warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:158:18: Attribute `root_frame` on type `None | @Todo` is possibly unbound
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/test/fake_time_util.py:58:20: Type `<module 'asyncio'>` has no attribute `get_running_loop`
- warning[lint:unused-ignore-comment] /tmp/mypy_primer/projects/pyinstrument/test/fake_time_util.py:63:26: Unused blanket `type: ignore` directive
- warning[lint:unused-ignore-comment] /tmp/mypy_primer/projects/pyinstrument/test/fake_time_util.py:65:84: Unused blanket `type: ignore` directive
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/pyinstrument/magic/magic.py:279:20: Type `<module 'asyncio'>` has no attribute `get_event_loop`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/pyinstrument/magic/magic.py:280:16: Type `<module 'asyncio'>` has no attribute `new_event_loop`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/pyinstrument/magic/magic.py:283:13: Type `<module 'asyncio'>` has no attribute `set_event_loop`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/pyinstrument/magic/magic.py:285:22: Type `<module 'asyncio'>` has no attribute `run_coroutine_threadsafe`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/pyinstrument/magic/magic.py:289:13: Type `<module 'asyncio'>` has no attribute `set_event_loop`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pyinstrument/examples/litestar_hello.py:3:21: Module `asyncio` has no member `sleep`
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pyinstrument/test/test_stack_sampler.py:107:9: Object of type `<bound method `subscribe` of `StackSampler`>` cannot be assigned to parameter 2 (`callable`) of bound method `run`; expected type `(...) -> Unknown`
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pyinstrument/test/test_stack_sampler.py:110:9: Object of type `<bound method `subscribe` of `StackSampler`>` cannot be assigned to parameter 2 (`callable`) of bound method `run`; expected type `(...) -> Unknown`
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pyinstrument/test/test_stack_sampler.py:125:19: Object of type `<bound method `unsubscribe` of `StackSampler`>` cannot be assigned to parameter 2 (`callable`) of bound method `run`; expected type `(...) -> Unknown`
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pyinstrument/test/test_stack_sampler.py:126:19: Object of type `<bound method `unsubscribe` of `StackSampler`>` cannot be assigned to parameter 2 (`callable`) of bound method `run`; expected type `(...) -> Unknown`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/pyinstrument/util.py:75:18: Type `<module 'codecs'>` has no attribute `lookup`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/examples/async_example_simple.py:10:15: Type `<module 'asyncio'>` has no attribute `sleep`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/examples/async_example_simple.py:15:1: Type `<module 'asyncio'>` has no attribute `run`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:42:15: Type `<module 'asyncio'>` has no attribute `sleep`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:101:19: Type `<module 'asyncio'>` has no attribute `sleep`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:115:16: Type `<module 'asyncio'>` has no attribute `new_event_loop`
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:158:18: Attribute `root_frame` on type `None | Unknown` is possibly unbound
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/examples/async_experiment_1.py:27:11: Type `<module 'asyncio'>` has no attribute `sleep`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/examples/async_experiment_1.py:37:8: Type `<module 'asyncio'>` has no attribute `get_event_loop`
- Found 287 diagnostics
+ Found 276 diagnostics

arrow (https://github.com/arrow-py/arrow)
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/factory.py:232:26: Type `<module 'dateutil.tz'>` has no attribute `tzutc`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/factory.py:340:18: Type `<module 'dateutil.tz'>` has no attribute `tzlocal`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/arrow.py:160:22: Type `<module 'dateutil.tz'>` has no attribute `tzutc`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/arrow.py:195:22: Type `<module 'dateutil.tz'>` has no attribute `tzlocal`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/arrow.py:223:30: Type `<module 'dateutil.tz'>` has no attribute `tzutc`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/arrow.py:252:22: Type `<module 'dateutil.tz'>` has no attribute `tzlocal`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/arrow.py:296:13: Type `<module 'dateutil.tz'>` has no attribute `tzutc`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/arrow.py:320:26: Type `<module 'dateutil.tz'>` has no attribute `tzutc`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/arrow.py:347:22: Type `<module 'dateutil.tz'>` has no attribute `tzutc`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/arrow.py:917:16: Type `<module 'dateutil.tz'>` has no attribute `datetime_ambiguous`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/arrow.py:923:20: Type `<module 'dateutil.tz'>` has no attribute `datetime_exists`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/arrow.py:1041:36: Type `<module 'dateutil.tz'>` has no attribute `datetime_exists`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/arrow.py:1042:23: Type `<module 'dateutil.tz'>` has no attribute `resolve_imaginary`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/arrow.py:1154:64: Type `<module 'dateutil.tz'>` has no attribute `tzutc`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/arrow.py:1795:20: Type `<module 'dateutil.tz'>` has no attribute `tzutc`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/formatter.py:124:18: Type `<module 'dateutil.tz'>` has no attribute `tzutc`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/parser.py:730:57: Type `<module 'dateutil.tz'>` has no attribute `tzutc`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/parser.py:737:20: Type `<module 'dateutil.tz'>` has no attribute `tzutc`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/parser.py:910:22: Type `<module 'dateutil.tz'>` has no attribute `tzlocal`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/parser.py:913:22: Type `<module 'dateutil.tz'>` has no attribute `tzutc`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/parser.py:928:26: Type `<module 'dateutil.tz'>` has no attribute `tzoffset`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/arrow/arrow/parser.py:931:26: Type `<module 'dateutil.tz'>` has no attribute `gettz`
- Found 74 diagnostics
+ Found 52 diagnostics

itsdangerous (https://github.com/pallets/itsdangerous)
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/encoding.py:44:17: Type `<module 'struct'>` has no attribute `Struct`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/serializer.py:112:35: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/serializer.py:112:56: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/serializer.py:128:35: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/serializer.py:128:56: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/serializer.py:144:35: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/serializer.py:144:56: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/serializer.py:163:35: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/serializer.py:163:56: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/serializer.py:179:35: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/serializer.py:179:56: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/serializer.py:194:35: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/serializer.py:194:56: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/serializer.py:289:66: Type `<module 'collections.abc'>` has no attribute `Iterator`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/timed.py:179:10: Type `<module 'collections.abc'>` has no attribute `Iterator`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/timed.py:180:24: Type `<module 'collections.abc'>` has no attribute `Iterator`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/signer.py:68:31: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/signer.py:68:52: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/signer.py:131:35: Type `<module 'collections.abc'>` has no attribute `Iterable`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/itsdangerous/src/itsdangerous/signer.py:131:56: Type `<module 'collections.abc'>` has no attribute `Iterable`
- Found 55 diagnostics
+ Found 35 diagnostics

black (https://github.com/psf/black)
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/blib2to3/pytree.py:15:29: Module `collections.abc` has no member `Iterable`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/blib2to3/pytree.py:15:39: Module `collections.abc` has no member `Iterator`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/trans.py:8:29: Module `collections.abc` has no member `Callable`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/trans.py:8:39: Module `collections.abc` has no member `Collection`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/trans.py:8:51: Module `collections.abc` has no member `Iterable`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/trans.py:8:61: Module `collections.abc` has no member `Iterator`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/trans.py:8:71: Module `collections.abc` has no member `Sequence`
+ error[lint:non-subscriptable] /tmp/mypy_primer/projects/black/src/black/trans.py:49:31: Cannot subscript object of type `Literal[Collection]` with no `__class_getitem__` method
+ error[lint:non-subscriptable] /tmp/mypy_primer/projects/black/src/black/trans.py:49:59: Cannot subscript object of type `Literal[Iterator]` with no `__class_getitem__` method
+ error[lint:invalid-return-type] /tmp/mypy_primer/projects/black/src/black/trans.py:2482:12: Object of type `Literal[insert_str_child]` is not assignable to return type `(@Todo, /) -> None`
+ error[lint:invalid-return-type] /tmp/mypy_primer/projects/black/src/black/trans.py:2509:12: Object of type `Literal[is_valid_index]` is not assignable to return type `(int, /) -> bool`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/lines.py:3:29: Module `collections.abc` has no member `Callable`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/lines.py:3:39: Module `collections.abc` has no member `Iterator`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/lines.py:3:49: Module `collections.abc` has no member `Sequence`
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/black/src/black/lines.py:684:56: Object of type `Literal[is_import]` cannot be assigned to parameter `first_leaf_matches` of bound method `is_fmt_pass_converted`; expected type `((Leaf, /) -> bool) | None`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/driver.py:24:29: Module `collections.abc` has no member `Iterable`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/driver.py:24:39: Module `collections.abc` has no member `Iterator`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/tokenize.py:31:29: Module `collections.abc` has no member `Iterator`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/comments.py:2:29: Module `collections.abc` has no member `Collection`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/comments.py:2:41: Module `collections.abc` has no member `Iterator`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/files.py:4:29: Module `collections.abc` has no member `Iterable`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/files.py:4:39: Module `collections.abc` has no member `Iterator`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/files.py:4:49: Module `collections.abc` has no member `Sequence`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/cache.py:8:29: Module `collections.abc` has no member `Iterable`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/pgen.py:5:29: Module `collections.abc` has no member `Iterator`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/pgen.py:5:39: Module `collections.abc` has no member `Sequence`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/parse.py:12:29: Module `collections.abc` has no member `Callable`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/parse.py:12:39: Module `collections.abc` has no member `Iterator`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/parsing.py:8:29: Module `collections.abc` has no member `Collection`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/parsing.py:8:41: Module `collections.abc` has no member `Iterator`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/__init__.py:9:5: Module `collections.abc` has no member `Collection`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/__init__.py:10:5: Module `collections.abc` has no member `Generator`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/__init__.py:11:5: Module `collections.abc` has no member `Iterator`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/__init__.py:12:5: Module `collections.abc` has no member `MutableMapping`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/__init__.py:13:5: Module `collections.abc` has no member `Sequence`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/__init__.py:14:5: Module `collections.abc` has no member `Sized`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/debug.py:1:29: Module `collections.abc` has no member `Iterator`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/concurrency.py:13:29: Module `collections.abc` has no member `Iterable`
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/black/src/black/__init__.py:1280:48: Object of type `<bound method `readline` of `BytesIO`> | @Todo` cannot be assigned to parameter 1 (`readline`) of function `detect_encoding`; expected type `() -> bytes | bytearray`
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/black/src/black/__init__.py:1280:48: Object of type `<bound method `readline` of `BytesIO`> | @Todo` cannot be assigned to parameter 1 (`readline`) of function `detect_encoding`; expected type `() -> bytes | bytearray`
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/black/src/black/__init__.py:1280:48: Object of type `<bound method `readline` of `BytesIO`> | @Todo` cannot be assigned to parameter 1 (`readline`) of function `detect_encoding`; expected type `() -> bytes | bytearray`
+ error[lint:non-subscriptable] /tmp/mypy_primer/projects/black/src/blackd/middlewares.py:8:31: Cannot subscript object of type `Literal[Awaitable]` with no `__class_getitem__` method
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:42:29: Type `<module 'asyncio'>` has no attribute `Future`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:49:20: Type `<module 'asyncio'>` has no attribute `AbstractEventLoop`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:53:39: Type `<module 'asyncio'>` has no attribute `all_tasks`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:59:33: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:99:12: Type `<module 'asyncio'>` has no attribute `new_event_loop`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:100:5: Type `<module 'asyncio'>` has no attribute `set_event_loop`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:117:13: Type `<module 'asyncio'>` has no attribute `set_event_loop`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:128:11: Type `<module 'asyncio'>` has no attribute `AbstractEventLoop`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:155:9: Type `<module 'asyncio'>` has no attribute `ensure_future`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:170:25: Type `<module 'asyncio'>` has no attribute `wait`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:170:25: Type `<module 'asyncio'>` has no attribute `wait`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:170:25: Type `<module 'asyncio'>` has no attribute `wait`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:170:59: Type `<module 'asyncio'>` has no attribute `FIRST_COMPLETED`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:170:59: Type `<module 'asyncio'>` has no attribute `FIRST_COMPLETED`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:170:59: Type `<module 'asyncio'>` has no attribute `FIRST_COMPLETED`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/black/concurrency.py:189:15: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/blackd/middlewares.py:1:29: Module `collections.abc` has no member `Awaitable`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/blackd/middlewares.py:1:40: Module `collections.abc` has no member `Callable`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/blackd/middlewares.py:1:50: Module `collections.abc` has no member `Iterable`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/nodes.py:6:29: Module `collections.abc` has no member `Iterator`
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/black/src/black/nodes.py:783:43: Object of type `<bound method `prefix` of `Node`> | Literal[prefix]` cannot be assigned to parameter 1 (`obj`) of function `len`; expected type `Sized`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/brackets.py:3:29: Module `collections.abc` has no member `Iterable`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/brackets.py:3:39: Module `collections.abc` has no member `Sequence`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/blackd/__init__.py:27:16: Type `<module 'asyncio'>` has no attribute `Event`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/blackd/__init__.py:127:16: Type `<module 'asyncio'>` has no attribute `get_event_loop`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/black/src/blackd/__init__.py:150:20: Type `<module 'asyncio'>` has no attribute `get_event_loop`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/ranges.py:4:29: Module `collections.abc` has no member `Collection`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/ranges.py:4:41: Module `collections.abc` has no member `Iterator`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/ranges.py:4:51: Module `collections.abc` has no member `Sequence`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/linegen.py:7:29: Module `collections.abc` has no member `Collection`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/black/src/black/linegen.py:7:41: Module `collections.abc` has no member `Iterator`
- Found 288 diagnostics
+ Found 235 diagnostics

rich (https://github.com/Textualize/rich)
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/rich/rich/highlighter.py:133:32: Object of type `<bound method `plain` of `Text`> | Literal[plain]` cannot be assigned to parameter 1 (`obj`) of function `len`; expected type `Sized`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/rich/rich/syntax.py:391:26: Type `<module 'os.path'>` has no attribute `splitext`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/rich/rich/syntax.py:391:26: Type `<module 'os.path'>` has no attribute `splitext`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/rich/rich/syntax.py:391:26: Type `<module 'os.path'>` has no attribute `splitext`
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/rich/rich/syntax.py:785:17: Object of type `<bound method `plain` of `Text`> | Literal[plain]` cannot be assigned to parameter 1 (`obj`) of function `len`; expected type `Sized`
+ error[lint:invalid-assignment] /tmp/mypy_primer/projects/rich/rich/pretty.py:226:9: Object of type `Literal[display_hook]` is not assignable to attribute `displayhook` of type `(object, /) -> Any`
+ error[lint:invalid-assignment] /tmp/mypy_primer/projects/rich/rich/traceback.py:173:9: Object of type `Literal[excepthook]` is not assignable to attribute `excepthook` of type `(type[BaseException], BaseException, TracebackType | None, /) -> Any`
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/rich/rich/traceback.py:688:34: Object of type `None | range` cannot be assigned to parameter 1 (`obj`) of function `len`; expected type `Sized`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/rich/examples/downloader.py:70:29: Type `<module 'os.path'>` has no attribute `join`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/rich/rich/scope.py:1:29: Module `collections.abc` has no member `Mapping`

pybind11 (https://github.com/pybind/pybind11)
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:112:12: Type `<module 'struct'>` has no attribute `unpack_from`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:113:12: Type `<module 'struct'>` has no attribute `unpack_from`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:152:17: Type `<module 'struct'>` has no attribute `unpack`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/setup.py:13:29: Module `collections.abc` has no member `Generator`
- Found 276 diagnostics
+ Found 272 diagnostics

isort (https://github.com/pycqa/isort)
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/settings.py:545:16: Type `<module 'stat'>` has no attribute `S_ISFIFO`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:97:29: Type `<module 'os.path'>` has no attribute `sep`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:100:44: Type `<module 'os.path'>` has no attribute `join`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:101:20: Type `<module 'os.path'>` has no attribute `isdir`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:101:34: Type `<module 'os.path'>` has no attribute `join`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:124:20: Type `<module 'os.path'>` has no attribute `abspath`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:131:32: Type `<module 'os.path'>` has no attribute `realpath`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:142:20: Type `<module 'os.path'>` has no attribute `isdir`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:148:30: Type `<module 'os.path'>` has no attribute `realpath`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:157:34: Type `<module 'os.path'>` has no attribute `normcase`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:178:66: Type `<module 'os.path'>` has no attribute `isdir`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:186:20: Type `<module 'os.path'>` has no attribute `normcase`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:194:20: Type `<module 'os.path'>` has no attribute `normcase`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:228:16: Type `<module 'os.path'>` has no attribute `dirname`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:229:16: Type `<module 'os.path'>` has no attribute `join`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:250:20: Type `<module 'os.path'>` has no attribute `dirname`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:254:16: Type `<module 'os.path'>` has no attribute `abspath`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:255:12: Type `<module 'os.path'>` has no attribute `isfile`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:256:20: Type `<module 'os.path'>` has no attribute `dirname`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:305:25: Type `<module 'os.path'>` has no attribute `join`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:308:16: Type `<module 'os.path'>` has no attribute `isdir`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:311:25: Type `<module 'os.path'>` has no attribute `join`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:318:16: Type `<module 'os.path'>` has no attribute `isfile`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/isort/isort/deprecated/finders.py:335:20: Type `<module 'os.path'>` has no attribute `dirname`
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/isort/isort/main.py:1126:77: Object of type `Literal[_preconvert]` cannot be assigned to parameter `default` of function `dumps`; expected type `((Any, /) -> Any) | None`
+ error[lint:invalid-argument-type] /tmp/mypy_primer/projects/isort/isort/main.py:1199:17: Object of type `partial` cannot be assigned to parameter 2 (`func`) of bound method `imap`; expected type `(Unknown | @Todo, /) -> Unknown | @Todo`
- Found 76 diagnostics
+ Found 54 diagnostics

mypy_primer (https://github.com/hauntsaninja/mypy_primer)
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/model.py:303:40: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/model.py:303:40: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/model.py:303:40: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/utils.py:69:13: Type `<module 'asyncio'>` has no attribute `Semaphore`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/utils.py:89:22: Type `<module 'asyncio'>` has no attribute `BoundedSemaphore`
+ error[lint:missing-argument] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/utils.py:104:26: No argument provided for required parameter `program` of function `create_subprocess_exec`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/utils.py:101:26: Type `<module 'asyncio'>` has no attribute `create_subprocess_shell`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/utils.py:104:26: Type `<module 'asyncio'>` has no attribute `create_subprocess_exec`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:30:32: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:30:32: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:30:32: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:46:52: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:46:52: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:46:52: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:46:52: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:46:52: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:59:38: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:59:38: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:59:38: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:73:52: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:73:52: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:73:52: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:73:52: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:73:52: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:172:30: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:205:21: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:241:16: Type `<module 'asyncio'>` has no attribute `as_completed`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:287:11: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:294:25: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:325:29: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:359:23: Type `<module 'asyncio'>` has no attribute `gather`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:411:23: Type `<module 'asyncio'>` has no attribute `as_completed`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/mypy_primer/mypy_primer/main.py:459:23: Type `<module 'asyncio'>` has no attribute `run`
- Found 49 diagnostics
+ Found 18 diagnostics

@AlexWaygood

This comment was marked as resolved.

@AlexWaygood AlexWaygood marked this pull request as ready for review March 22, 2025 23:54
@AlexWaygood AlexWaygood force-pushed the alex/star-imports-redux branch from 9752faa to 4e6f758 Compare March 23, 2025 11:22
@AlexWaygood
Copy link
Member Author

Still not sure why the collections.abc integration test is still failing, but other than that I'm pretty happy with this now!

I figured out the bug here and fixed it. Unfortunately, fixing the bug completely broke all our special casing for the builtin len() function. This is because len() has a parameter annotated with the collections.abc.Sized protocol in typeshed's builtins.pyi stub, and with my PR we now half-understand the collections.abc.Sized type (enough to emit false-positive errors 🙃) instead of not understanding it at all.

There were a huge amount of test failures in len.md resulting from this, so for now I've added a KnownClass::Sized variant and some special-casing for KnownClass::Sized to Type::is_assignable_to(). This is very similar to the existing special-casing @sharkdp had to add for typing.SupportsIndex in an earlier PR.

Copy link
Contributor

github-actions bot commented Mar 23, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@AlexWaygood AlexWaygood force-pushed the alex/star-imports-redux branch 4 times, most recently from 9479f00 to 550a937 Compare March 23, 2025 13:27
Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

@AlexWaygood
Copy link
Member Author

(haven't finished addressing/responding to review comments yet, will continue tomorrow!)

Comment on lines +1039 to +1041
let Some(module) = resolve_module(self.db, &module_name) else {
continue;
};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should cache the resolved module in the DefinitionKind for * import definitions? It feels slightly silly to re-resolve the module name and module for these definitions in infer.rs, when we know that we wouldn't have created any definitions for the node during semantic indexing unless the module name and module were both resolvable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm, this involves quite an annoying amount of refactoring unless we also cache the resolved ModuleName as well as the File on StarImportDefinitionKind. Leaning towards leaning this as-is for now, even though the duplication of logic between this file and infer.rs is somewhat annoying.

@AlexWaygood AlexWaygood force-pushed the alex/star-imports-redux branch 3 times, most recently from 7a6bc73 to 92d50f1 Compare March 24, 2025 11:22
@AlexWaygood AlexWaygood force-pushed the alex/star-imports-redux branch from 92d50f1 to ca5184f Compare March 24, 2025 11:29
Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

AlexWaygood added a commit that referenced this pull request Mar 24, 2025
## Summary

This PR separates out the entirely new tests from
#16923 into a standalone PR. I'll
rebase #16923 on top of this
branch.

The reasons for separating it out are:
- It should make it clearer to see in
<#16923> exactly how the
functionality is changing (we can see the assertions in the tests
_change_, which isn't so obvious if the tests are entirely new)
- The diff on <#16923> is getting
pretty big; this should reduce the diff on that PR somewhat
- These tests seem useful in and of themselves, so even if we need to do
a wholesale revert of <#16923> for
whatever reason, it'll be nice to keep the tests

## Test Plan

`cargo test -p red_knot_python_semantic`
@AlexWaygood AlexWaygood enabled auto-merge (squash) March 24, 2025 17:12
@AlexWaygood AlexWaygood merged commit e87fee4 into main Mar 24, 2025
22 checks passed
@AlexWaygood AlexWaygood deleted the alex/star-imports-redux branch March 24, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ty Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants