-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ty] Ensure Literal types are considered assignable to anything their Instance supertypes are assignable to
#18351
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
[ty] Ensure Literal types are considered assignable to anything their Instance supertypes are assignable to
#18351
Conversation
|
I think there's room for more tests here but I'm not exactly sure what tests to add |
|
This looks correct to me but mypy_primer crashed on this branch when checking |
|
thanks for looking into that |
|
Nothing obvious. You'd have to look into where |
|
|
It succeeded on the third attempt, so I guess we were just unlucky here! |
AlexWaygood
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!
|
There's a bunch of weird primer hits in the diff that look like we no longer understand that |
|
When I run primer locally, I always get 173 diagnostics on mkdocs (on main or on this PR branch), but the primer diff here is showing 207 on main and 210 on this PR branch. No idea yet why they are different. |
|
Going to try rebasing this on latest main and pushing again to see how that impacts primer results. |
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
83d414b to
4c0f051
Compare
|
Definitely seems like for whatever reason this PR causes us to hit the cycle assertion more often. Hopefully we're closing in on a fix for that issue, so let's just hold off on this for a moment. |
AlexWaygood
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this is great. Now that 54f5976 has landed on main, the primer changes look fantastic, and it appears we no longer get any new primer crashes from this PR
|
I also checked the property tests locally on this branch, and all looks good. |
Literal types are considered assignable to anything their Instance supertypes are assignable to
…aration * origin/main: [ty] Treat lambda functions as instances of types.FunctionType (#18431) [ty] Fix false positives for legacy `ParamSpec`s inside `Callable` type expressions (#18426) [ty] Improve diagnostics if the user attempts to import a stdlib module that does not exist on their configured Python version (#18403) Update taiki-e/install-action action to v2.52.4 (#18420) Update docker/build-push-action action to v6.18.0 (#18422) [ty] Fix server hang after shutdown request (#18414) Update Rust crate libcst to v1.8.0 (#18424) Update Rust crate clap to v4.5.39 (#18419) Update cargo-bins/cargo-binstall action to v1.12.6 (#18416) Update dependency mdformat-mkdocs to v4.3.0 (#18421) Update pre-commit dependencies (#18418) Update dependency ruff to v0.11.12 (#18417) [ty] Ensure `Literal` types are considered assignable to anything their `Instance` supertypes are assignable to (#18351) [ty] Promote projects to good that now no longer hang (#18370) Sync vendored typeshed stubs (#18407) [ty] Fix multithreading related hangs and panics (#18238) Support relative `--ty-path` in ty-benchmark (#18385) [ty] Update docs for Python version inference (#18397) [ty] Infer the Python version from the environment if feasible (#18057) Implement template strings (#17851)
Summary
Resolves astral-sh/ty#531
Test Plan
Update
is_assignable_to.md