Skip to content
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

[red-knot] infer_symbol_public_type infers union of all definitions #11667

Closed
wants to merge 4 commits into from

Conversation

carljm
Copy link
Contributor

@carljm carljm commented Jun 1, 2024

Summary

Rename infer_symbol_type to infer_symbol_public_type, and allow it to work on symbols with more than one definition. For now, use the most cautious/sound inference, which is the union of all definitions. We can prune this union more in future by eliminating definitions if we can show that they can't be visible (this requires both that the symbol is definitely later reassigned, and that there is no intervening call/import that might be able to see the over-written definition).

Test Plan

Added a test showing inference of union from multiple definitions.

@carljm carljm added the red-knot Multi-file analysis & type inference label Jun 1, 2024
@carljm carljm requested a review from MichaReiser as a code owner June 1, 2024 00:06
Copy link

codspeed-hq bot commented Jun 1, 2024

CodSpeed Performance Report

Merging #11667 will improve performances by 11.01%

Comparing carljm:cfg (18a64d8) with main (b80bf22)

Summary

⚡ 1 improvements
✅ 29 untouched benchmarks

Benchmarks breakdown

Benchmark main carljm:cfg Change
parser[numpy/ctypeslib.py] 1.2 ms 1 ms +11.01%

Copy link
Contributor

github-actions bot commented Jun 1, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@carljm carljm requested a review from AlexWaygood June 1, 2024 01:33
@carljm
Copy link
Contributor Author

carljm commented Jun 1, 2024

Closing in favor of #11669, which uses a source branch in the Astral repo instead of my own repo; this lets me stack PRs.

@carljm carljm closed this Jun 1, 2024
@carljm carljm deleted the cfg branch June 1, 2024 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant