[ty] treat union-bound typevars like unions for possibly-missing-attribute#25561
Merged
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 91.94%. The percentage of expected errors that received a diagnostic held steady at 87.09%. The number of fully passing files held steady at 92/134. |
Memory usage reportMemory usage unchanged ✅ |
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
possibly-missing-attribute |
0 | 1 | 0 |
unresolved-attribute |
1 | 0 | 0 |
| Total | 1 | 1 | 0 |
Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.
Raw diff:
core (https://github.com/home-assistant/core)
- homeassistant/components/sonos/helpers.py:82:42 warning[possibly-missing-attribute] Attribute `soco` may be missing on object of type `_T@soco_error`
+ homeassistant/components/sonos/helpers.py:82:42 error[unresolved-attribute] Attribute `soco` is not defined on `SonosHouseholdCoordinator` in union `_SonosEntitiesType`
AlexWaygood
approved these changes
Jun 2, 2026
AlexWaygood
left a comment
Member
There was a problem hiding this comment.
What error code do we use if you try to access .hex() on an instance of a NewType of float?
Contributor
Author
|
carljm
added a commit
that referenced
this pull request
Jun 3, 2026
* origin/main: (114 commits) [ty] Detect disjointness due to incompatible generic specializations (#24822) Update Rust crate memchr to v2.8.1 (#25586) [ty] Reject Self in type aliases (#25529) Update Rust crate log to v0.4.30 (#25572) Update Rust crate mimalloc to v0.1.52 (#25573) Update Rust crate similar to v3.1.1 (#25575) Update docker/setup-buildx-action action to v4.1.0 (#25580) Update docker/metadata-action action to v6.1.0 (#25579) Update docker/login-action action to v4.2.0 (#25578) Update docker/build-push-action action to v7.2.0 (#25577) Update taiki-e/install-action action to v2.79.9 (#25576) Update Rust crate serde_json to v1.0.150 (#25574) Update Rust crate assert_fs to v1.1.4 (#25570) Update prek dependencies (#25569) Update dependency ruff to v0.15.15 (#25568) Update dependency pyright to v1.1.410 (#25566) Update dependency astral-sh/uv to v0.11.18 (#25565) [ty] don't needlessly disambiguate same type alias (#25563) [ty] fix variance inference for nested type aliases (#25567) [ty] treat union-bound typevars like unions for possibly-missing-attribute (#25561) ... # Conflicts: # crates/ty_python_semantic/src/types/class.rs # crates/ty_python_semantic/src/types/generics.rs # crates/ty_python_semantic/src/types/type_alias.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Treat bounded
TypeVars like their upper bound when deciding whether apossibly-missing-attributeshould be promoted tounresolved-attribute. We missed this case in #23042, and then we disabledpossibly-missing-attributeby default, so on main we are silent by default when accessing an attribute that is missing on some elements of a typevar upper-bound union.Testing
Added mdtest.