Skip to content

Commit 27b7c4f

Browse files
migeed-zfacebook-github-bot
authored andcommitted
Pass class information to subset check
Summary: We need the class information to compute variance for the subset check, instead of passing down the arguments and type params, we pass the classes. Next, we have to create a binding where variance can be retrived via the class + type parameter. Reviewed By: rchen152 Differential Revision: D75489378 fbshipit-source-id: 5399010abe6847289d1ebb323086f0427608bb85
1 parent 4e67e6f commit 27b7c4f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pyrefly/lib/solver/subset.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@ use crate::types::callable::ParamList;
2626
use crate::types::callable::Params;
2727
use crate::types::callable::Required;
2828
use crate::types::class::ClassType;
29-
use crate::types::class::TArgs;
3029
use crate::types::quantified::QuantifiedKind;
3130
use crate::types::simplify::unions;
3231
use crate::types::tuple::Tuple;
3332
use crate::types::type_var::Restriction;
3433
use crate::types::type_var::Variance;
3534
use crate::types::types::Forall;
3635
use crate::types::types::Forallable;
37-
use crate::types::types::TParams;
3836
use crate::types::types::Type;
3937

4038
impl<'a, Ans: LookupAnswer> Subset<'a, Ans> {
@@ -784,7 +782,7 @@ impl<'a, Ans: LookupAnswer> Subset<'a, Ans> {
784782
return false;
785783
}
786784
match self.type_order.as_superclass(got, want.class_object()) {
787-
Some(got) => self.check_targs(got.targs(), want.targs(), want.tparams()),
785+
Some(got) => self.check_targs(&got, want),
788786
// Structural checking for assigning to protocols
789787
None if want_is_protocol => {
790788
self.is_subset_protocol(got.clone().to_type(), want.clone())
@@ -995,7 +993,10 @@ impl<'a, Ans: LookupAnswer> Subset<'a, Ans> {
995993
}
996994
}
997995

998-
fn check_targs(&mut self, got: &TArgs, want: &TArgs, params: &TParams) -> bool {
996+
fn check_targs(&mut self, got_class: &ClassType, want_class: &ClassType) -> bool {
997+
let got = got_class.targs();
998+
let want = want_class.targs();
999+
let params = want_class.tparams();
9991000
let got = got.as_slice();
10001001
let want = want.as_slice();
10011002
if !(got.len() == want.len() && want.len() == params.len()) {

0 commit comments

Comments
 (0)