@@ -103,6 +103,54 @@ PHP 8.6 INTERNALS UPGRADE NOTES
103103 . The deprecated Z_IMMUTABLE(), Z_IMMUTABLE_P(), Z_OPT_IMMUTABLE(), and
104104 Z_OPT_IMMUTABLE_P() macros have been removed. Check for
105105 IS_ARRAY && !REFCOUNTED directly.
106+ . Added support for runtime-bound-checked generic type parameters. The
107+ main additions:
108+ . New types in zend_compile.h: zend_generic_parameter,
109+ zend_generic_parameter_list, zend_generic_type_table, and
110+ zend_generic_scope_entry. Allocate / destroy via
111+ zend_generic_parameter_list_alloc(),
112+ zend_generic_parameter_list_destroy(),
113+ zend_generic_type_table_alloc(), and
114+ zend_generic_type_table_destroy().
115+ . zend_op_array and zend_class_entry both gained an optional
116+ `generic_parameters` (declared parameter list) and an optional
117+ `generic_types` side table holding the pre-erasure forms of
118+ return types, parameter types, property types, class-constant
119+ types, the extends type, implements list, and trait-use list.
120+ The runtime arg_info / property / class-constant slots continue
121+ to hold only the erased form.
122+ . New AST kinds: ZEND_AST_GENERIC_TYPE_PARAMETER_LIST,
123+ ZEND_AST_GENERIC_TYPE_PARAMETER, ZEND_AST_GENERIC_NAMED_TYPE,
124+ ZEND_AST_GENERIC_TYPE_ARGUMENT_LIST, ZEND_AST_TURBOFISH.
125+ . zend_ast_decl::child[] grew from 5 to 6 entries; the new slot
126+ carries an optional generic-parameter-list AST.
127+ . The child-count groups of ZEND_AST_CALL, ZEND_AST_NEW,
128+ ZEND_AST_METHOD_CALL, ZEND_AST_NULLSAFE_METHOD_CALL, and
129+ ZEND_AST_STATIC_CALL each gained one optional child holding the
130+ call-site turbofish type-argument list. Code that walks these
131+ nodes by hard-coded child count must be updated.
132+ . zend_ast_export handles the new generic AST kinds.
133+ . Two new bits on zend_type's type_mask:
134+ _ZEND_TYPE_TYPE_PARAMETER_BIT (1u << 25) and
135+ _ZEND_TYPE_NAMED_WITH_ARGS_BIT (1u << 31), with payload structs
136+ zend_type_parameter_ref { zend_string *name; uint32_t index;
137+ uint8_t origin; } and zend_type_named_with_args { zend_string
138+ *name; uint32_t name_attr; uint32_t count; zend_type args[]; }.
139+ These bits only ever appear in pre-erasure forms held by the
140+ side table; runtime arg_info / property / class-constant types
141+ never carry them. Helpers: ZEND_TYPE_HAS_TYPE_PARAMETER(),
142+ ZEND_TYPE_TYPE_PARAMETER(), ZEND_TYPE_HAS_NAMED_WITH_ARGS(),
143+ ZEND_TYPE_NAMED_WITH_ARGS().
144+ . New compiler-globals fields: CG(type_arg_depth) (right-angle
145+ split state used by the zendlex wrapper), CG(token_residual)
146+ (single-token pushback slot), and CG(generic_scope) (linked
147+ stack of in-scope type parameters).
148+ . New T_TURBOFISH lexer token (literal `::<`). The zendlex wrapper
149+ splits T_SR (`>>`), T_IS_GREATER_OR_EQUAL (`>=`), and T_SR_EQUAL
150+ (`>>=`) into separate `>` tokens whenever CG(type_arg_depth) is
151+ non-zero, with a single-token pushback slot.
152+ . Module API bumped to 20260506; extension API bumped to
153+ 420260506. All extensions must be recompiled.
106154
107155========================
1081562. Build system changes
0 commit comments