[ty] Preserve qualifiers when accessing attributes on unions/intersections by sharkdp · Pull Request #20114 · astral-sh/ruff (original) (raw)
added the ty
Multi-file analysis & type inference
label
sharkdp changed the title
[ty] Fix attribute access on intersection types [ty] Preserve qualifiers when accessing attributes on unions/intersections
sharkdp marked this pull request as ready for review
sharkdp marked this pull request as ready for review
sharkdp deleted the david/attribute-access-on-intersections-again branch
carljm added a commit to leandrobbraga/ruff that referenced this pull request
- main:
[
ruff] Preserve relative whitespace in multi-line expressions (RUF033) (astral-sh#19647) [ty] Optimize TDD atom ordering (astral-sh#20098) [airflow] ExtendAIR311andAIR312rules (astral-sh#20082) [ty] Preserve qualifiers when accessing attributes on unions/intersections (astral-sh#20114) [ty] Fix the inferred interface of specialized generic protocols (astral-sh#19866) [ty] Infer slightly more precise types for comprehensions (astral-sh#20111) [ty] Add more tests for protocols (astral-sh#20095) [ty] don't eagerly unpack aliases in user-authored unions (astral-sh#20055) [flake8-use-pathlib] Update links to the table showing the correspondence betweenosandpathlib(astral-sh#20103) [flake8-use-pathlib] MakePTH100fix unsafe because it can change behavior (astral-sh#20100) [flake8-use-pathlib] Delete unusedRule::OsSymlinkenabled check (astral-sh#20099) [ty] Add search paths info to unresolved import diagnostics (astral-sh#20040) [flake8-logging-format] Add auto-fix for f-string logging calls (G004) (astral-sh#19303) Add aScopeKindfor the__class__cell (astral-sh#20048) Fix incorrect D413 links in docstrings convention FAQ (astral-sh#20089) [ty] Refactor inlay hints structure to use separate parts (astral-sh#20052)
second-ed pushed a commit to second-ed/ruff that referenced this pull request
…tions (astral-sh#20114)
Summary
Properly preserve type qualifiers when accessing attributes on unions and intersections. This is a prerequisite for astral-sh#19579.
Also fix a completely wrong implementation of
map_with_boundness_and_qualifiers. It now closely follows
map_with_boundness (just above).
Test Plan
I thought about it, but didn't find any easy way to test this. This only
affected Type::member. Things like validation of attribute writes
(where type qualifiers like ClassVar and Final are important) were
already handling things correctly.
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
[ Show hidden characters]({{ revealButtonHref }})