1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

numeric.c: fix message

* numeric.c (coerce_failed): fix the error message on non-flonum
  platforms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-01-13 12:07:14 +00:00
parent 748325b80d
commit 6a852f7ab8

View file

@ -237,9 +237,14 @@ NORETURN(static void coerce_failed(VALUE x, VALUE y));
static void
coerce_failed(VALUE x, VALUE y)
{
if (SPECIAL_CONST_P(y) || BUILTIN_TYPE(y) == T_FLOAT) {
y = rb_inspect(y);
}
else {
y = rb_obj_class(y);
}
rb_raise(rb_eTypeError, "%"PRIsVALUE" can't be coerced into %"PRIsVALUE,
(rb_special_const_p(y)? rb_inspect(y) : rb_obj_class(y)),
rb_obj_class(x));
y, rb_obj_class(x));
}
static VALUE