Please sign in to comment.
Handle interfaces consistently for IsTypeStruct and InstanceOf
Summary: Inconsistencies in how IsTypeStruct* and InstanceOf* handled interfaces caused issues when IsTypeStruct* ops reduced to InstanceOf* ops. Essentially the taken branch of InstanceOf IMyInterface would always propagate IMyInterface as the type, while IsTypeStruct was always propagating the best known type at the time. These are likely going to be incompatible as interfaces and objects that implement them are not required to be in the same type hierarchy. I attempted first to switch InstanceOf type propagation to use intersection_of, but this causes other issues with interfaces. intersection_of always returns the non interface type. This causes issues with something like this: ``` if ($t instanceOf IMyInterface) ``` If in an earlier analysis round we didn't have information about the type of $t we would propagate IMyInterface, but in a later round we might learn that $t is a MyClass object which might be incompatible. This makes the handling of interfaces explicit, and consistend for the two. It also fixes some mistakes in type refinements for IstTypeStruct. Reviewed By: markw65 Differential Revision: D10557702 fbshipit-source-id: 9bc59639d258b207a2e813fb070004224a50b1c7
- Loading branch information...