Skip to content

Commit ad0816d

Browse files
committed
rename
1 parent 1405cc5 commit ad0816d

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

Zend/zend_globals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ struct _zend_compiler_globals {
152152
HashTable *unlinked_uses;
153153
zend_class_entry *current_linking_class;
154154
/* Those are initialized and destroyed by zend_do_inheritance_ex() */
155-
HashTable *bound_associated_types;
155+
HashTable *bound_generic_types;
156156

157157
uint32_t rtd_key_counter;
158158

Zend/zend_inheritance.c

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -679,25 +679,24 @@ ZEND_API inheritance_status zend_perform_covariant_type_check(
679679
zend_class_entry *fe_scope, const zend_type *fe_type_ptr,
680680
zend_class_entry *proto_scope, const zend_type *proto_type_ptr);
681681

682-
static inheritance_status zend_is_type_subtype_of_associated_type(
682+
static inheritance_status zend_is_type_subtype_of_generic_type(
683683
zend_class_entry *concrete_scope,
684684
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
687687
) {
688-
const zend_type associated_type = *associated_type_ptr;
688+
const zend_type generic_type = *generic_type_ptr;
689689

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));
692692

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));
695694
ZEND_ASSERT(bound_type_ptr != NULL);
696695
/* Generic type must be invariant */
697696
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);
699698
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);
701700

702701
if (sub_type_status != super_type_status) {
703702
return INHERITANCE_ERROR;
@@ -723,12 +722,12 @@ ZEND_API inheritance_status zend_perform_covariant_type_check(
723722

724723
/* If we check for concrete return type */
725724
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(
727726
fe_scope, fe_type_ptr, proto_scope, proto_type_ptr);
728727
}
729728
/* If we check for concrete parameter type */
730729
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(
732731
proto_scope, proto_type_ptr, fe_scope, fe_type_ptr);
733732
}
734733

@@ -2241,7 +2240,7 @@ static void do_interface_implementation(zend_class_entry *ce, zend_class_entry *
22412240
}
22422241
HashTable *ht = emalloc(sizeof(HashTable));
22432242
zend_hash_init(ht, num_bound_types, NULL, NULL, false);
2244-
CG(bound_associated_types) = ht;
2243+
CG(bound_generic_types) = ht;
22452244
for (uint32_t i = 0; i < num_bound_types; i++) {
22462245
const zend_generic_parameter *generic_parameter = &iface->generic_parameters[i];
22472246
const zend_type* generic_constraint = &generic_parameter->constraint;
@@ -2321,10 +2320,10 @@ static void do_interface_implementation(zend_class_entry *ce, zend_class_entry *
23212320
if (iface->num_interfaces) {
23222321
zend_do_inherit_interfaces(ce, iface);
23232322
}
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;
23282327
}
23292328
}
23302329
/* }}} */

0 commit comments

Comments
 (0)