Fix is_subtype_of - we cannot use ->equals
authorDave Rolsky <autarch@urth.org>
Fri, 16 Sep 2011 14:11:05 +0000 (09:11 -0500)
committerJesse Luehrs <doy@tozt.net>
Sat, 17 Sep 2011 18:56:19 +0000 (13:56 -0500)
commit7463cac215b5bec6df3ebefae92b356a1f805fba
tree43732e63c5c79ef84eeb56afd78cad3b8ac6b4c0
parent4afd861de36529c371f794724b394f6df5cc89df
Fix is_subtype_of - we cannot use ->equals

Calling $parent->equals in is_subtype_of is broken. The parent may be a union
type, in which case it overrides $parent->equals will never return true.

However, union types override ->is_a_type_of and ->is_subtype_of to do
something sensible. Changing $parent->equals to $parent->is_a_type_of respects
that overriding and gets us sane behavior.
lib/Moose/Meta/TypeConstraint.pm