abstract constants: preclass/class emission [2/2]
Summary: `abstract const` in a class has the same general purpose as an
abstract method: prevent a class from being 'concrete' unless it
defines that constant. Trying to reference a value of an abstract
constant remains a fatal (as if it were not defined at all).
PHP5 doesn't allow interface constants to be redefined in any
implementing class. In contrast, this diff allows interface/abstract
class constants to be defined as `abstract` in a addition to regular
definitions. This allows (and for non-abstract children, forces)
extending classes to provide concrete definitions for those
constants. This diff does not touch the prohibition on constants in
traits.
Between preclass emitter, preclass, class, and hhbbc, we have an
impressive number of structs that represent constants. In all of
these, the ## val ## of a const is changed from being a TypedValue to
a ##folly::optional<TypedValue>##, with ##folly::none## representing
an abstract constant definition. For constant values,
##KindOfUninit## is already taken as the representation values
requiring runtime calculations (e.g. 'const X = self::Y;').
Note: all this diff does for runtime reflection support is actively
hide the abstract constant definitions.
Reviewed By: @jdelong
Differential Revision:
D1693734
Signature: t1:
1693734:
1416989210:
8f15fa8069018553973f0b285315f02330096323