New semantic analyzer: allow redefinition of star-imported functions if type is the same
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Consider this test case:
[case testReExportOtherSameType]
from low_level import *
def func(arg: str) -> int:
...
[file low_level.py]
def func(arg: str) -> int:
...
It is currently allowed by old analyzer (likely by accident), but prohibited by the new one. Old analyzer still prohibits this if the function is imported by name instead of star import. Although behavior of the new analyzer is more consistent, it may be sometimes useful to allow the redefinition (for example when star import re-exports hundred functions).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the test case testReExportOtherSameType and its two files, which demonstrate a star import from low_level.py followed by a same-signature definition. Read the new semantic analyzer's handling of star-imported functions and compare it with the old analyzer. Done means the intended same-type redefinition behavior is covered by a passing test without changing the separate named-import behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100