Assert correct types in get_id_serial_entry

This commit is contained in:
Peter Zhu 2024-04-05 16:14:45 -04:00
parent a80e8ba1c4
commit 43dcf4d1a6

View file

@ -481,6 +481,19 @@ get_id_serial_entry(rb_id_serial_t num, ID id, const enum id_entry_type t)
}
GLOBAL_SYMBOLS_LEAVE();
if (result) {
switch (t) {
case ID_ENTRY_STR:
RUBY_ASSERT(BUILTIN_TYPE(result) == T_STRING);
break;
case ID_ENTRY_SYM:
RUBY_ASSERT(SYMBOL_P(result));
break;
default:
break;
}
}
return result;
}