Crell / enum-comparison

A comparison of enumerations and similar features in different languages
80 stars 7 forks source link

Clarify types of operations that are allowed in expressions in RFC document/implementation #59

Closed TysonAndre closed 3 years ago

TysonAndre commented 3 years ago

https://wiki.php.net/rfc/enumerations currently says

Scalar equivalent values must be literals. Constants and constant expressions are not supported.

This was relaxed to allow -1 - -1 is not a literal

        0 => AST_UNARY_OP [UNARY_MINUS] #1
                expr => 1

The representation of PHP_INT_MIN is not a literal (9223372036854775808 is a float, and the negation of a float is a float)

php > var_export(PHP_INT_MIN);
-9223372036854775807-1

Related to #56

Crell commented 3 years ago

RFC updated accordingly.