summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--symbol.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/symbol.c b/symbol.c
index 052cc2d3ee..7be0a61a75 100644
--- a/symbol.c
+++ b/symbol.c
@@ -953,12 +953,17 @@ rb_id2sym(ID x)
VALUE
rb_sym2str(VALUE sym)
{
+ VALUE str;
if (DYNAMIC_SYM_P(sym)) {
- return RSYMBOL(sym)->fstr;
+ str = RSYMBOL(sym)->fstr;
+ RUBY_ASSERT(BUILTIN_TYPE(str) == T_STRING);
}
else {
- return rb_id2str(STATIC_SYM2ID(sym));
+ str = rb_id2str(STATIC_SYM2ID(sym));
+ RUBY_ASSERT(str == 0 || BUILTIN_TYPE(str) == T_STRING);
}
+
+ return str;
}
VALUE