@@ -1437,6 +1437,7 @@ static zend_string *add_intersection_type(zend_string *str,
1437
1437
zend_string * zend_type_to_string_resolved (const zend_type type , zend_class_entry * scope ) {
1438
1438
zend_string * str = NULL ;
1439
1439
1440
+ ZEND_ASSERT (!ZEND_TYPE_IS_GENERIC_PARAM_NAME (type ) && "Generic type declarations do not exist yet" );
1440
1441
/* Pure intersection type */
1441
1442
if (ZEND_TYPE_IS_INTERSECTION (type )) {
1442
1443
ZEND_ASSERT (!ZEND_TYPE_IS_UNION (type ));
@@ -1457,8 +1458,6 @@ zend_string *zend_type_to_string_resolved(const zend_type type, zend_class_entry
1457
1458
str = add_type_string (str , resolved , /* is_intersection */ false);
1458
1459
zend_string_release (resolved );
1459
1460
} ZEND_TYPE_LIST_FOREACH_END ();
1460
- } else if (ZEND_TYPE_IS_ASSOCIATED (type )) {
1461
- ZEND_ASSERT (false && "Generic type declarations do not exist yet" );
1462
1461
} else if (ZEND_TYPE_HAS_NAME (type )) {
1463
1462
str = resolve_class_name (ZEND_TYPE_NAME (type ), scope );
1464
1463
}
@@ -7220,7 +7219,7 @@ static zend_type zend_compile_typename_ex(
7220
7219
single_type = zend_compile_single_typename (type_ast );
7221
7220
uint32_t single_type_mask = ZEND_TYPE_PURE_MASK (single_type );
7222
7221
7223
- if (ZEND_TYPE_IS_ASSOCIATED (single_type )) {
7222
+ if (ZEND_TYPE_IS_GENERIC_PARAM_NAME (single_type )) {
7224
7223
zend_error_noreturn (E_COMPILE_ERROR , "Generic type cannot be part of a union type" );
7225
7224
}
7226
7225
if (single_type_mask == MAY_BE_ANY ) {
@@ -7305,7 +7304,7 @@ static zend_type zend_compile_typename_ex(
7305
7304
zend_ast * type_ast = list -> child [i ];
7306
7305
zend_type single_type = zend_compile_single_typename (type_ast );
7307
7306
7308
- if (ZEND_TYPE_IS_ASSOCIATED (single_type )) {
7307
+ if (ZEND_TYPE_IS_GENERIC_PARAM_NAME (single_type )) {
7309
7308
zend_error_noreturn (E_COMPILE_ERROR , "Generic type cannot be part of an intersection type" );
7310
7309
}
7311
7310
/* An intersection of union types cannot exist so invalidate it
@@ -7374,10 +7373,10 @@ static zend_type zend_compile_typename_ex(
7374
7373
if ((type_mask & MAY_BE_NULL ) && is_marked_nullable ) {
7375
7374
zend_error_noreturn (E_COMPILE_ERROR , "null cannot be marked as nullable" );
7376
7375
}
7377
- if (ZEND_TYPE_IS_ASSOCIATED (type ) && is_marked_nullable ) {
7376
+ if (ZEND_TYPE_IS_GENERIC_PARAM_NAME (type ) && is_marked_nullable ) {
7378
7377
zend_error_noreturn (E_COMPILE_ERROR , "Generic type cannot be part of a union type" );
7379
7378
}
7380
- if (ZEND_TYPE_IS_ASSOCIATED (type ) && force_allow_null ) {
7379
+ if (ZEND_TYPE_IS_GENERIC_PARAM_NAME (type ) && force_allow_null ) {
7381
7380
zend_error_noreturn (E_COMPILE_ERROR , "Generic type cannot be part of a union type (implicitly nullable due to default null value)" );
7382
7381
}
7383
7382
@@ -9173,7 +9172,7 @@ static void zend_compile_generic_params(zend_ast *params_ast)
9173
9172
9174
9173
if (param_ast -> child [1 ]) {
9175
9174
constraint_type = zend_compile_typename (param_ast -> child [1 ]);
9176
- if (ZEND_TYPE_IS_ASSOCIATED (constraint_type )) {
9175
+ if (ZEND_TYPE_IS_GENERIC_PARAM_NAME (constraint_type )) {
9177
9176
zend_error_noreturn (E_COMPILE_ERROR ,
9178
9177
"Cannot use generic parameter %s to constrain generic parameter %s" ,
9179
9178
ZSTR_VAL (ZEND_TYPE_NAME (constraint_type )), ZSTR_VAL (name ));
0 commit comments