-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support php 8.1 intersection types #208
Conversation
To be merged if https://wiki.php.net/rfc/final_class_const passes and is merged into php 8.1
This will only be merged if the RFC is approved and the implementation is merged into php 8.1 https://wiki.php.net/rfc/pure-intersection-types
e458d28
to
69d2f97
Compare
ast.c
Outdated
{ ZEND_AST_CLASS_CONST_DECL, 1, visibility_flags }, | ||
{ ZEND_AST_CLASS_CONST_GROUP, 1, visibility_flags }, | ||
{ ZEND_AST_CLASS_CONST_DECL, 1, class_const_flags }, | ||
{ ZEND_AST_CLASS_CONST_GROUP, 1, class_const_flags }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this is pre-existing, but why does CONST_DECL have class_const_flags? Aren't they always on the GROUP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AST_CLASS_CONST_GROUP class, attributes // version 80+
CLASS_CONST_GROUP was added in version 80 to support attributes, because CONST_DECL->children is a list of nodes - earlier versions have no GROUP at all
ast.c
Outdated
@@ -274,6 +274,12 @@ static const char *visibility_flags[] = { | |||
NULL | |||
}; | |||
|
|||
static const char *class_const_flags[] = { | |||
AST_VISIBILITY_FLAGS, | |||
AST_FLAG(MODIFIER_FINAL), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, as far as parsing is concerned, it's possible for all AST_MODIFIER_FLAGS to occur here. STATIC/ABSTRACT are rejected during compilation. Maybe we want to skip the distinction between modifier_flags and class_const_flags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we want to skip the distinction between modifier_flags and class_const_flags?
Makes sense
Support https://wiki.php.net/rfc/pure-intersection-types and the final class constant modifier