summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index bed329881ef..92791f82a25 100644
--- a/compile.c
+++ b/compile.c
@@ -2504,7 +2504,8 @@ case_when_optimizable_literal(NODE * node)
modf(RFLOAT_VALUE(v), &ival) == 0.0) {
return FIXABLE(ival) ? LONG2FIX((long)ival) : rb_dbl2big(ival);
}
- if (SYMBOL_P(v) || rb_obj_is_kind_of(v, rb_cNumeric)) {
+ if (SYMBOL_P(v) || RB_TYPE_P(v, T_STRING) ||
+ rb_obj_is_kind_of(v, rb_cNumeric)) {
return v;
}
break;