mirror of https://github.com/astral-sh/ruff
canonical ordering for constraint set mappings
This commit is contained in:
parent
ddcd76c544
commit
3c811c19d4
|
|
@ -1589,10 +1589,20 @@ impl<'db> SpecializationBuilder<'db> {
|
|||
let upper = constraint.upper(self.db);
|
||||
if !upper.is_object() {
|
||||
let variance = formal.variance_of(self.db, typevar);
|
||||
self.add_type_mapping(typevar, upper, variance, &mut f);
|
||||
self.add_type_mapping(
|
||||
typevar,
|
||||
upper.canonically_ordered(self.db),
|
||||
variance,
|
||||
&mut f,
|
||||
);
|
||||
} else if !lower.is_never() {
|
||||
let variance = formal.variance_of(self.db, typevar);
|
||||
self.add_type_mapping(typevar, lower, variance, &mut f);
|
||||
self.add_type_mapping(
|
||||
typevar,
|
||||
lower.canonically_ordered(self.db),
|
||||
variance,
|
||||
&mut f,
|
||||
);
|
||||
}
|
||||
if let Type::TypeVar(lower_bound_typevar) = lower {
|
||||
let variance = formal.variance_of(self.db, lower_bound_typevar);
|
||||
|
|
|
|||
Loading…
Reference in New Issue