[ty] Remove hack in protocol satisfiability check (#20568)

## Summary

This removes a hack in the protocol satisfiability check that was
previously needed to work around missing assignability-modeling of
inferable type variables. Assignability of type variables is not
implemented fully, but some recent changes allow us to remove that hack
with limited impact on the ecosystem (and the test suite). The change in
the typing conformance test is favorable.

## Test Plan

* Adapted Markdown tests
* Made sure that this change works in combination with
https://github.com/astral-sh/ruff/pull/20517
This commit is contained in:
David Peter 2025-09-25 13:35:47 +02:00 committed by GitHub
parent 9f3cffc65c
commit efbb80f747
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 38 additions and 29 deletions

View file

@ -23,7 +23,6 @@ use crate::{
diagnostic::report_undeclared_protocol_member,
signatures::{Parameter, Parameters},
todo_type,
visitor::any_over_type,
},
};
@ -571,24 +570,7 @@ impl<'a, 'db> ProtocolMember<'a, 'db> {
attribute_type
};
let proto_member_as_bound_method = method.bind_self(db);
if any_over_type(
db,
proto_member_as_bound_method,
&|t| matches!(t, Type::TypeVar(_)),
true,
) {
// TODO: proper validation for generic methods on protocols
return ConstraintSet::from(true);
}
attribute_type.has_relation_to_impl(
db,
proto_member_as_bound_method,
relation,
visitor,
)
attribute_type.has_relation_to_impl(db, method.bind_self(db), relation, visitor)
}
// TODO: consider the types of the attribute on `other` for property members
ProtocolMemberKind::Property(_) => ConstraintSet::from(matches!(