File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
crates/ty_python_semantic Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -369,5 +369,5 @@ type Y = X | str | dict[str, Y]
369369
370370def _ (y : Y):
371371 if isinstance (y, dict ):
372- reveal_type(y)
372+ reveal_type(y) # revealed: dict[str, X] | dict[str, Y]
373373```
Original file line number Diff line number Diff line change @@ -1422,6 +1422,7 @@ impl<'db> Type<'db> {
14221422 /// P`, but not `B <: P`. Losing transitivity of subtyping is not tenable (it makes union and
14231423 /// intersection simplification dependent on the order in which elements are added), so we do
14241424 /// not use this more general definition of subtyping.
1425+ #[ salsa:: tracked( cycle_fn=is_subtype_of_cycle_recover, cycle_initial=is_subtype_of_cycle_initial) ]
14251426 pub ( crate ) fn is_subtype_of ( self , db : & ' db dyn Db , target : Type < ' db > ) -> bool {
14261427 self . when_subtype_of ( db, target) . is_always_satisfied ( )
14271428 }
@@ -6654,6 +6655,24 @@ impl<'db> VarianceInferable<'db> for Type<'db> {
66546655 }
66556656}
66566657
6658+ fn is_subtype_of_cycle_recover < ' db > (
6659+ _db : & ' db dyn Db ,
6660+ _value : & bool ,
6661+ _count : u32 ,
6662+ _subtype : Type < ' db > ,
6663+ _supertype : Type < ' db > ,
6664+ ) -> salsa:: CycleRecoveryAction < bool > {
6665+ salsa:: CycleRecoveryAction :: Iterate
6666+ }
6667+
6668+ fn is_subtype_of_cycle_initial < ' db > (
6669+ _db : & ' db dyn Db ,
6670+ _subtype : Type < ' db > ,
6671+ _supertype : Type < ' db > ,
6672+ ) -> bool {
6673+ true
6674+ }
6675+
66576676fn apply_specialization_cycle_recover < ' db > (
66586677 _db : & ' db dyn Db ,
66596678 _value : & Type < ' db > ,
You can’t perform that action at this time.
0 commit comments