Skip to content

Commit

Permalink
Assert correct types in get_id_serial_entry
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzhu2118 committed Apr 5, 2024
1 parent a80e8ba commit 43dcf4d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions symbol.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit 43dcf4d

Please sign in to comment.