astral-sh
ruff
Blog
Docs
Changelog
Blog
Docs
Changelog
Overview
Branches
Benchmarks
Runs
Performance History
Latest Results
[ty] Allow equality narrowing across non-final classes (#27031) ## Summary Prior to this change, equality and membership narrowing preserved otherwise-incompatible union members because a subclass could override `__eq__`. By default, we now assume that subclasses of a non-final class do not override the inherited comparison method: ```py class Foo: ... def f(value: Foo | None, other: Foo) -> None: reveal_type(None == other) # Literal[False] if value == other: reveal_type(value) # Foo if value in [other]: reveal_type(value) # Foo ``` The behavior is intentionally unsound. Users who want conservative equality behavior can enable the single `strict-equality-narrowing` setting, which also preserves broad builtin types instead of narrowing them to literals: ```toml [tool.ty.analysis] strict-equality-narrowing = true ``` For compatibility, `strict-literal-narrowing` remains supported as an alias for `strict-equality-narrowing`. Closes https://github.com/astral-sh/ty/issues/3419.
main
6 minutes ago
[ty] Simplify equality comparison policy handling
charlie/fix-ty-3419-equality-narrowing
12 minutes ago
[π] test eager and lazy constraint-set negation equivalence
dcreager/bdd-visitor
15 minutes ago
[ty] Document conservative equality semantics
charlie/fix-ty-3419-equality-narrowing
19 minutes ago
[ty] Clarify strict equality semantics documentation
charlie/fix-ty-3419-equality-narrowing
47 minutes ago
moar tests, why not
alex/remove-single-valued-types
56 minutes ago
[ty] Clarify strict equality semantics documentation
charlie/fix-ty-3419-equality-narrowing
58 minutes ago
[ty] Avoid exponential inference for mixed TypedDict unions
zbarsky-openai:ty-mixed-typed-dict-perf
1 hour ago
Latest Branches
CodSpeed Performance Gauge
0%
[ty] Allow equality narrowing across non-final classes
#27031
17 minutes ago
5154144
charlie/fix-ty-3419-equality-narrowing
CodSpeed Performance Gauge
0%
[ty] Reimplement constraint set walking as a visitor
#27036
23 minutes ago
3a86ea1
dcreager/bdd-visitor
CodSpeed Performance Gauge
0%
[ty] Remove `Type::is_single_valued()`
#26992
1 hour ago
d4994d4
alex/remove-single-valued-types
© 2026 CodSpeed Technology
Home
Terms
Privacy
Docs