You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
This diff fixes the following issues that arise from the fact that enum classes are tagged with `AttrEnum` by making `AttrEnum` and `AttrEnumClass` mutually exclusive:
- Jumpstart serialization assumed that any `AttrEnum` class had a base type that was either `int` or `string` (this was actually doubly wrong as even for enums this type could also have been `arraykey`)
- A variety of places in hhbbc, the jit, and the runtime treat any `AttrEnum` type name as though it's an alias for the enum's base type. This is not true of enum classes.
- Checks were missing to prevent enum classes from including enums and vice-versa
- BuiltinEnumClass was the only class marked AttrEnumClass but not AttrEnum, now it is marked neither to match BuiltinEnum (which is not marked AttrEnum). This made the fix to Class::setParent below possible
Additionally the following mostly benign issues were fixed:
- Dead code in Class::classof (which would have been broken had it been possible to instantiate an enum class) was removed
- Dead code in Class::setParent that assumed it was possible to extend an enum class (by means other than enum inclusion) was removed (all enums extend BuiltinEnum and all enum classes extend BuiltinEnumClass)
- In index.cpp a check for enums which include other enums had erroneously negated a check for AttrEnum
- In prof-data-serialize.cpp we weren't reading/writing included enums. While not strictly a requirement for correctness it is better to do this here.
Reviewed By: jano
Differential Revision: D27574956
fbshipit-source-id: 36910981a3daf7d5c5c01a48df2f62fd22fd8608
0 commit comments