You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
- make `Value.get_type_value()` context-aware so type-value computation
can reuse normal simplification rules
- simplify `IntersectionValue.get_type_value()` via `intersect_multi()`
and `MultiValuedValue.get_type_value()` via `unite_values()`
- model predicate type-values as `type[object]` and add regression tests
for `hasattr()`-guarded constructor calls
## Why
Taxonomy hit confusing constructor overloads after `hasattr()` narrowing
because `type(tag)` preserved predicate-derived fallback class branches
instead of simplifying back to the real class object.
## Root cause
`get_type_value()` was context-free and
`IntersectionValue.get_type_value()` just wrapped member type-values in
a new intersection without normalizing them. That left callable fallback
members in place long enough for constructor signature collection to
turn them into spurious overloads like `object.__init__`.
## Testing
- `UV_CACHE_DIR=/tmp/uv-cache uv run --python 3.14 --extra tests pytest
pycroscope/test_value.py pycroscope/test_constructors.py`
Copy file name to clipboardExpand all lines: docs/changelog.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
3
3
## Unreleased
4
4
5
+
- Simplify `type()` lookups through narrowed intersections, so `hasattr()`-guarded class-object calls preserve the real constructor signature instead of picking up confusing fallback overloads like `object.__init__`.
5
6
- Fix assignability involving weak list literals in nested invariant containers, so values like `defaultdict(lambda: ([], []))` can satisfy annotated tuple-valued `dict` entries instead of failing on the inner empty-list literals.
6
7
- Improve nested tuple mismatch diagnostics so assignments involving tuple-valued generics now report which tuple element failed instead of the vague message `tuple is not assignable to tuple`.
7
8
- Add an opt-in `--find-unused-call-patterns` check, plus `enforce_no_unused_call_patterns`, to report parameters whose accepted call shapes are only partially exercised, including always-omitted defaults, one-sided boolean flags, and unused union members.
0 commit comments