Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Remove class-loading check for overriding type constants
Summary: This fatals, but hh is fine with it ``` interface I1 { abstract const type T = nothing; } interface I2 extends I1 { const type T = mixed; } ``` I went digging and discovered that HHVM doesn't understand that the type const in I1 is abstract. In fact the abstract keyword doesn't result in any emission differences. This is the rust structure: ``` pub struct HhasTypeConstant { pub name: String, pub initializer: Option<TypedValue>, } ``` It's just "Is there a value? no -> abstract, else -> non-abstract" Then in the class loading code we have this: ``` // Forbid redefining constants from interfaces, but not superclasses. // Constants from interfaces implemented by superclasses can be // overridden. ``` This is super weird IMO. At the very least we need to not fatal on this case (it has direct applications for coeffects). In the best case, we'd probably have HHVM understand the notion of abstract w/ default. As I see it there are basically 2 options: 1. delete the check (for type constants). It seems weird enough as it is that it's the only restrictions on redefinitions. Then again, that results in HHVM not having any confirmation that the hierarchy is reasonable, but we don't enforce them anyway, so that might be OK? 2. do a bunch of work to redo how HHVM sees type constants and potentially add more checks. I'm going to do the first here as a short term solution and then we can discuss the latter in more detail. Reviewed By: paulbiss Differential Revision: D26076753 fbshipit-source-id: 6aedfc10d4ab31fc61782adbadd09203aa8b9cc8
- Loading branch information