@@ -679,25 +679,24 @@ ZEND_API inheritance_status zend_perform_covariant_type_check(
679
679
zend_class_entry * fe_scope , const zend_type * fe_type_ptr ,
680
680
zend_class_entry * proto_scope , const zend_type * proto_type_ptr );
681
681
682
- static inheritance_status zend_is_type_subtype_of_associated_type (
682
+ static inheritance_status zend_is_type_subtype_of_generic_type (
683
683
zend_class_entry * concrete_scope ,
684
684
const zend_type * concrete_type_ptr ,
685
- zend_class_entry * associated_type_scope ,
686
- const zend_type * associated_type_ptr
685
+ zend_class_entry * generic_type_scope ,
686
+ const zend_type * generic_type_ptr
687
687
) {
688
- const zend_type associated_type = * associated_type_ptr ;
688
+ const zend_type generic_type = * generic_type_ptr ;
689
689
690
- ZEND_ASSERT (CG (bound_associated_types ) && "Have associated type" );
691
- ZEND_ASSERT (ZEND_TYPE_HAS_NAME (associated_type ));
690
+ ZEND_ASSERT (CG (bound_generic_types ) && "Have generic type" );
691
+ ZEND_ASSERT (ZEND_TYPE_HAS_NAME (generic_type ));
692
692
693
- zend_string * associated_type_name = ZEND_TYPE_NAME (associated_type );
694
- const zend_type * bound_type_ptr = zend_hash_find_ptr (CG (bound_associated_types ), associated_type_name );
693
+ const zend_type * bound_type_ptr = zend_hash_find_ptr (CG (bound_generic_types ), ZEND_TYPE_NAME (generic_type ));
695
694
ZEND_ASSERT (bound_type_ptr != NULL );
696
695
/* Generic type must be invariant */
697
696
const inheritance_status sub_type_status = zend_perform_covariant_type_check (
698
- concrete_scope , concrete_type_ptr , associated_type_scope , bound_type_ptr );
697
+ concrete_scope , concrete_type_ptr , generic_type_scope , bound_type_ptr );
699
698
const inheritance_status super_type_status = zend_perform_covariant_type_check (
700
- associated_type_scope , bound_type_ptr , concrete_scope , concrete_type_ptr );
699
+ generic_type_scope , bound_type_ptr , concrete_scope , concrete_type_ptr );
701
700
702
701
if (sub_type_status != super_type_status ) {
703
702
return INHERITANCE_ERROR ;
@@ -723,12 +722,12 @@ ZEND_API inheritance_status zend_perform_covariant_type_check(
723
722
724
723
/* If we check for concrete return type */
725
724
if (ZEND_TYPE_IS_ASSOCIATED (proto_type )) {
726
- return zend_is_type_subtype_of_associated_type (
725
+ return zend_is_type_subtype_of_generic_type (
727
726
fe_scope , fe_type_ptr , proto_scope , proto_type_ptr );
728
727
}
729
728
/* If we check for concrete parameter type */
730
729
if (ZEND_TYPE_IS_ASSOCIATED (fe_type )) {
731
- return zend_is_type_subtype_of_associated_type (
730
+ return zend_is_type_subtype_of_generic_type (
732
731
proto_scope , proto_type_ptr , fe_scope , fe_type_ptr );
733
732
}
734
733
@@ -2241,7 +2240,7 @@ static void do_interface_implementation(zend_class_entry *ce, zend_class_entry *
2241
2240
}
2242
2241
HashTable * ht = emalloc (sizeof (HashTable ));
2243
2242
zend_hash_init (ht , num_bound_types , NULL , NULL , false);
2244
- CG (bound_associated_types ) = ht ;
2243
+ CG (bound_generic_types ) = ht ;
2245
2244
for (uint32_t i = 0 ; i < num_bound_types ; i ++ ) {
2246
2245
const zend_generic_parameter * generic_parameter = & iface -> generic_parameters [i ];
2247
2246
const zend_type * generic_constraint = & generic_parameter -> constraint ;
@@ -2321,10 +2320,10 @@ static void do_interface_implementation(zend_class_entry *ce, zend_class_entry *
2321
2320
if (iface -> num_interfaces ) {
2322
2321
zend_do_inherit_interfaces (ce , iface );
2323
2322
}
2324
- if (CG (bound_associated_types )) {
2325
- zend_hash_destroy (CG (bound_associated_types ));
2326
- efree (CG (bound_associated_types ));
2327
- CG (bound_associated_types ) = NULL ;
2323
+ if (CG (bound_generic_types )) {
2324
+ zend_hash_destroy (CG (bound_generic_types ));
2325
+ efree (CG (bound_generic_types ));
2326
+ CG (bound_generic_types ) = NULL ;
2328
2327
}
2329
2328
}
2330
2329
/* }}} */
0 commit comments