mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:14:52 +00:00
use constraint sets for lhs contrained typevars
This commit is contained in:
parent
c6f5bca2a8
commit
19c421a27b
1 changed files with 18 additions and 2 deletions
|
@ -1612,9 +1612,17 @@ impl<'db> Type<'db> {
|
|||
.constraints(db)
|
||||
.when_some_and(|constraints| {
|
||||
constraints.iter().when_all(db, |constraint| {
|
||||
ConstraintSet::constrain_typevar(
|
||||
db,
|
||||
bound_typevar,
|
||||
*constraint,
|
||||
*constraint,
|
||||
)
|
||||
.implies(db, || {
|
||||
self.has_relation_to_impl(db, *constraint, relation, visitor)
|
||||
})
|
||||
})
|
||||
})
|
||||
.is_never_satisfied() =>
|
||||
{
|
||||
// TODO: The repetition here isn't great, but we really need the fallthrough logic,
|
||||
|
@ -1626,9 +1634,17 @@ impl<'db> Type<'db> {
|
|||
.constraints(db)
|
||||
.when_some_and(|constraints| {
|
||||
constraints.iter().when_all(db, |constraint| {
|
||||
ConstraintSet::constrain_typevar(
|
||||
db,
|
||||
bound_typevar,
|
||||
*constraint,
|
||||
*constraint,
|
||||
)
|
||||
.implies(db, || {
|
||||
self.has_relation_to_impl(db, *constraint, relation, visitor)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
(Type::TypeVar(_), _) if relation.is_assignability() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue