mirror of https://github.com/astral-sh/ruff
debug
This commit is contained in:
parent
1e33d25d1c
commit
af67d7307a
|
|
@ -439,6 +439,10 @@ impl<'db> ConstraintSet<'db> {
|
|||
pub(crate) fn display(self, db: &'db dyn Db) -> impl Display {
|
||||
self.node.simplify_for_display(db).display(db)
|
||||
}
|
||||
|
||||
pub(crate) fn display_graph(self, db: &'db dyn Db, prefix: &dyn Display) -> impl Display {
|
||||
self.node.display_graph(db, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<bool> for ConstraintSet<'_> {
|
||||
|
|
|
|||
|
|
@ -1651,7 +1651,10 @@ impl<'db> SpecializationBuilder<'db> {
|
|||
}
|
||||
|
||||
(Type::Callable(formal_callable), _) => {
|
||||
eprintln!("==> {}", formal.display(self.db));
|
||||
eprintln!(" {}", actual.display(self.db));
|
||||
let Some(actual_callables) = actual.try_upcast_to_callable(self.db) else {
|
||||
eprintln!(" -> NOPE");
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
|
|
@ -1659,19 +1662,31 @@ impl<'db> SpecializationBuilder<'db> {
|
|||
for formal_signature in &formal_callable.signatures(self.db).overloads {
|
||||
for actual_callable in actual_callables.as_slice() {
|
||||
for actual_signature in &actual_callable.signatures(self.db).overloads {
|
||||
when.union(
|
||||
eprintln!(" -> pair");
|
||||
eprintln!(" {}", formal_signature.display(self.db));
|
||||
eprintln!(" {}", actual_signature.display(self.db));
|
||||
let x = formal_signature.when_constraint_set_assignable_to(
|
||||
self.db,
|
||||
formal_signature.when_constraint_set_assignable_to(
|
||||
self.db,
|
||||
actual_signature,
|
||||
self.inferable,
|
||||
),
|
||||
actual_signature,
|
||||
self.inferable,
|
||||
);
|
||||
eprintln!(" {}", x.display(self.db));
|
||||
eprintln!(" {}", x.display_graph(self.db, &" "));
|
||||
when.union(self.db, x);
|
||||
}
|
||||
}
|
||||
}
|
||||
eprintln!("--> combined");
|
||||
eprintln!(" {}", when.display(self.db));
|
||||
eprintln!(" {}", when.display_graph(self.db, &" "));
|
||||
|
||||
when.for_each_path(self.db, |path| {
|
||||
eprintln!(
|
||||
"--> path [{}]",
|
||||
path.positive_constraints()
|
||||
.map(|c| c.display(self.db))
|
||||
.format(", ")
|
||||
);
|
||||
for constraint in path.positive_constraints() {
|
||||
let typevar = constraint.typevar(self.db);
|
||||
let lower = constraint.lower(self.db);
|
||||
|
|
|
|||
|
|
@ -975,19 +975,33 @@ impl<'db> Signature<'db> {
|
|||
let mut check_types = |type1: Option<Type<'db>>, type2: Option<Type<'db>>| {
|
||||
let type1 = type1.unwrap_or(Type::unknown());
|
||||
let type2 = type2.unwrap_or(Type::unknown());
|
||||
!result
|
||||
.intersect(
|
||||
db,
|
||||
type1.has_relation_to_impl(
|
||||
eprintln!(" ~> {} ≤ {}", type1.display(db), type2.display(db));
|
||||
eprintln!(
|
||||
" ~> when {}",
|
||||
type1
|
||||
.has_relation_to_impl(
|
||||
db,
|
||||
type2,
|
||||
inferable,
|
||||
relation,
|
||||
relation_visitor,
|
||||
disjointness_visitor,
|
||||
),
|
||||
)
|
||||
.is_never_satisfied(db)
|
||||
)
|
||||
.display(db)
|
||||
);
|
||||
result.intersect(
|
||||
db,
|
||||
type1.has_relation_to_impl(
|
||||
db,
|
||||
type2,
|
||||
inferable,
|
||||
relation,
|
||||
relation_visitor,
|
||||
disjointness_visitor,
|
||||
),
|
||||
);
|
||||
eprintln!(" ~> inter {}", result.display(db));
|
||||
!result.is_never_satisfied(db)
|
||||
};
|
||||
|
||||
// Return types are covariant.
|
||||
|
|
|
|||
Loading…
Reference in New Issue