diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-01-29 22:00:58 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-01-29 22:00:58 +0000 |
commit | c34e9f23aa2b6909e92623710e91cd99eaff2dc3 (patch) | |
tree | 5c7a3f0dc46c41f15e82c52a15db57710182ef5d /object.c | |
parent | 115a51f8ec4972d6a1b4000b50536b1a64a1888e (diff) |
* object.c: Improve error for failed implicit conversions [Bug #7539]
* error.c: Adapt rdoc
* test/ruby/test_object.rb: Test for above
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -2277,6 +2277,7 @@ static struct conv_method_tbl { {"to_s", 0}, {NULL, 0} }; +#define IMPLICIT_CONVERSIONS 7 static VALUE convert_type(VALUE val, const char *tname, const char *method, int raise) @@ -2296,7 +2297,9 @@ convert_type(VALUE val, const char *tname, const char *method, int raise) r = rb_check_funcall(val, m, 0, 0); if (r == Qundef) { if (raise) { - rb_raise(rb_eTypeError, "can't convert %s into %s", + rb_raise(rb_eTypeError, i < IMPLICIT_CONVERSIONS + ? "no implicit conversion of %s into %s" + : "can't convert %s into %s", NIL_P(val) ? "nil" : val == Qtrue ? "true" : val == Qfalse ? "false" : |