summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-21 09:16:44 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-21 09:16:44 +0000
commitc2d571c37feb7b9f35e4653717422ae79b13312c (patch)
treebd4302887daa89a2bd812c24a06f8e8562bea1ff /complex.c
parent7eb5dcf325ae01bdade65191f247c2410d3decbe (diff)
merges r23718 from trunk into ruby_1_9_1.
-- * complex.c (nucomp_coerce): accepts Complex instances. * rational.c (nurat_coerce): accepts Rational instances. [ruby-core:23859] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@23793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/complex.c b/complex.c
index b3b55c6856..62bc7a6f37 100644
--- a/complex.c
+++ b/complex.c
@@ -753,6 +753,8 @@ nucomp_coerce(VALUE self, VALUE other)
{
if (k_numeric_p(other) && f_real_p(other))
return rb_assoc_new(f_complex_new_bang1(CLASS_OF(self), other), self);
+ if (TYPE(other) == T_COMPLEX)
+ return rb_assoc_new(other, self);
rb_raise(rb_eTypeError, "%s can't be coerced into %s",
rb_obj_classname(other), rb_obj_classname(self));