File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
crates/ty_python_semantic Expand file tree Collapse file tree 2 files changed +21
-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,25 @@ impl<'db> VarianceInferable<'db> for Type<'db> {
66546655 }
66556656}
66566657
6658+ #[ allow( clippy:: trivially_copy_pass_by_ref) ]
6659+ fn is_subtype_of_cycle_recover < ' db > (
6660+ _db : & ' db dyn Db ,
6661+ _value : & bool ,
6662+ _count : u32 ,
6663+ _subtype : Type < ' db > ,
6664+ _supertype : Type < ' db > ,
6665+ ) -> salsa:: CycleRecoveryAction < bool > {
6666+ salsa:: CycleRecoveryAction :: Iterate
6667+ }
6668+
6669+ fn is_subtype_of_cycle_initial < ' db > (
6670+ _db : & ' db dyn Db ,
6671+ _subtype : Type < ' db > ,
6672+ _supertype : Type < ' db > ,
6673+ ) -> bool {
6674+ true
6675+ }
6676+
66576677fn apply_specialization_cycle_recover < ' db > (
66586678 _db : & ' db dyn Db ,
66596679 _value : & Type < ' db > ,
You can’t perform that action at this time.
0 commit comments