Commit 52134fe
authored
[codex] Remove redundant type-param and constructor fallback logic (#450)
## Summary
This removes another round of redundant fallback logic that had
accumulated around generic class registration and synthetic constructor
handling.
The main changes are:
- remove redundant class type-parameter recovery and registration
branches in `name_check_visitor.py`
- remove dead class-scope and inferred-registration fallback paths that
no longer affect behavior after the earlier type-param cleanup
- remove dead synthetic-constructor fallback branches in `checker.py`,
including a late dataclass constructor retry and a manual synthetic
`__init__` signature reconstruction path
- trim a now-unused helper parameter in the synthetic member initializer
path
## Why
These paths were re-deriving information that pycroscope already
computes canonically from class bases, declared type parameters, and the
main synthetic constructor machinery. Keeping the extra fallback
branches around made the code harder to reason about and increased the
risk of the branches drifting apart.
This PR keeps the canonical abstractions in charge:
- class type parameters come from class analysis and base handling
- synthetic constructor signatures come from the main constructor
selection logic rather than ad hoc late fallbacks
## Impact
This is a cleanup/refactor PR with no intended user-visible behavior
change. The result is less code, fewer fallback paths, and tighter
adherence to the existing abstractions around `TypeObject`, generic
metadata, and synthetic constructor handling.
## Validation
- `uv run --python 3.14 --extra tests pytest`
- `uv run --python 3.12 python tools/conformance_ci.py --typing-repo
~/py/typing`1 parent 37e61f1 commit 52134fe
2 files changed
Lines changed: 5 additions & 140 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1500 | 1500 | | |
1501 | 1501 | | |
1502 | 1502 | | |
1503 | | - | |
| 1503 | + | |
1504 | 1504 | | |
1505 | 1505 | | |
1506 | 1506 | | |
| |||
1567 | 1567 | | |
1568 | 1568 | | |
1569 | 1569 | | |
1570 | | - | |
| 1570 | + | |
1571 | 1571 | | |
1572 | 1572 | | |
1573 | 1573 | | |
| |||
1895 | 1895 | | |
1896 | 1896 | | |
1897 | 1897 | | |
1898 | | - | |
1899 | | - | |
1900 | | - | |
1901 | | - | |
1902 | | - | |
1903 | | - | |
1904 | | - | |
1905 | | - | |
1906 | 1898 | | |
1907 | 1899 | | |
1908 | 1900 | | |
| |||
2435 | 2427 | | |
2436 | 2428 | | |
2437 | 2429 | | |
2438 | | - | |
2439 | | - | |
2440 | | - | |
2441 | | - | |
2442 | | - | |
2443 | | - | |
2444 | | - | |
2445 | | - | |
2446 | | - | |
2447 | | - | |
2448 | | - | |
2449 | | - | |
2450 | | - | |
2451 | | - | |
2452 | 2430 | | |
2453 | 2431 | | |
2454 | 2432 | | |
| |||
2867 | 2845 | | |
2868 | 2846 | | |
2869 | 2847 | | |
2870 | | - | |
2871 | | - | |
2872 | | - | |
| 2848 | + | |
2873 | 2849 | | |
2874 | 2850 | | |
2875 | 2851 | | |
| |||
2887 | 2863 | | |
2888 | 2864 | | |
2889 | 2865 | | |
2890 | | - | |
| 2866 | + | |
2891 | 2867 | | |
2892 | 2868 | | |
2893 | 2869 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4225 | 4225 | | |
4226 | 4226 | | |
4227 | 4227 | | |
4228 | | - | |
4229 | | - | |
4230 | | - | |
4231 | 4228 | | |
4232 | 4229 | | |
4233 | 4230 | | |
| |||
4243 | 4240 | | |
4244 | 4241 | | |
4245 | 4242 | | |
4246 | | - | |
4247 | | - | |
4248 | | - | |
4249 | | - | |
4250 | | - | |
4251 | | - | |
4252 | | - | |
4253 | | - | |
4254 | | - | |
4255 | | - | |
4256 | | - | |
4257 | | - | |
4258 | | - | |
4259 | | - | |
4260 | | - | |
4261 | | - | |
4262 | | - | |
4263 | | - | |
4264 | | - | |
4265 | | - | |
4266 | | - | |
4267 | | - | |
4268 | | - | |
4269 | | - | |
4270 | | - | |
4271 | | - | |
4272 | | - | |
4273 | | - | |
4274 | | - | |
4275 | | - | |
4276 | | - | |
4277 | | - | |
4278 | | - | |
4279 | | - | |
4280 | | - | |
4281 | 4243 | | |
4282 | 4244 | | |
4283 | 4245 | | |
| |||
4312 | 4274 | | |
4313 | 4275 | | |
4314 | 4276 | | |
4315 | | - | |
4316 | | - | |
4317 | | - | |
4318 | | - | |
4319 | | - | |
4320 | | - | |
4321 | | - | |
4322 | | - | |
4323 | | - | |
4324 | | - | |
4325 | | - | |
4326 | | - | |
4327 | | - | |
4328 | | - | |
4329 | | - | |
4330 | | - | |
4331 | | - | |
4332 | | - | |
4333 | | - | |
4334 | | - | |
4335 | | - | |
4336 | | - | |
4337 | | - | |
4338 | | - | |
4339 | | - | |
4340 | | - | |
4341 | | - | |
4342 | | - | |
4343 | | - | |
4344 | | - | |
4345 | | - | |
4346 | | - | |
4347 | | - | |
4348 | | - | |
4349 | | - | |
4350 | | - | |
4351 | | - | |
4352 | | - | |
4353 | | - | |
4354 | | - | |
4355 | | - | |
4356 | | - | |
4357 | | - | |
4358 | | - | |
| 4277 | + | |
4359 | 4278 | | |
4360 | 4279 | | |
4361 | 4280 | | |
| |||
4422 | 4341 | | |
4423 | 4342 | | |
4424 | 4343 | | |
4425 | | - | |
4426 | | - | |
4427 | | - | |
4428 | | - | |
4429 | | - | |
4430 | | - | |
4431 | | - | |
4432 | | - | |
4433 | | - | |
4434 | | - | |
4435 | | - | |
4436 | | - | |
4437 | | - | |
4438 | | - | |
4439 | | - | |
4440 | | - | |
4441 | | - | |
4442 | | - | |
4443 | | - | |
4444 | | - | |
4445 | | - | |
4446 | | - | |
4447 | | - | |
4448 | | - | |
4449 | | - | |
4450 | | - | |
4451 | | - | |
4452 | | - | |
4453 | 4344 | | |
4454 | 4345 | | |
4455 | 4346 | | |
| |||
4476 | 4367 | | |
4477 | 4368 | | |
4478 | 4369 | | |
4479 | | - | |
4480 | | - | |
4481 | 4370 | | |
4482 | 4371 | | |
4483 | 4372 | | |
| |||
0 commit comments