Imports with syntax `from .submodule import name` in `__init__.py` modules bind the submodule
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 516
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the Bug
In an example like
```
from .foo import bar
print(foo)
```
the name `foo` is defined - we should be binding the name and including it in the exports.
Note that in principle, this could also shadow other names, e.g. in this example:
```
from .baz import bar
from .bar import foo
```
the `from .bar import foo` binds the name `bar`, which overwrites the original binding
Came up in discussion of #932, but I realized that it is really a separate problem whose root cause is gaps in the logic of `definitions.rs` and `bindings.rs`. It is also probably lower priority, since except in the shadowing case (which is artificial in that that pattern isn't very likely in real codebases) we already handle downstream reads reasonably well.
### Sandbox Link
_No response_
### (Only applicable for extension issues) IDE Information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.