This is an automated email from the git hooks/post-receive script. js pushed a commit to tag 1.001_002 in repository libtype-tiny-perl.
commit 9c789388723e10607dc491c6d0de600717b2ae09 Author: Toby Inkster <[email protected]> Date: Tue Sep 30 22:30:11 2014 +0100 implement subtype/supertype stuff in unions (TODO: needs testing) --- lib/Type/Tiny/Union.pm | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/lib/Type/Tiny/Union.pm b/lib/Type/Tiny/Union.pm index 9266273..a02484d 100644 --- a/lib/Type/Tiny/Union.pm +++ b/lib/Type/Tiny/Union.pm @@ -213,6 +213,49 @@ sub equals @other_constraints == 0; } +sub is_a_type_of +{ + my ($self, $other) = Type::Tiny::_loose_to_TypeTiny(@_); + return unless blessed($self) && $self->isa("Type::Tiny"); + return unless blessed($other) && $other->isa("Type::Tiny"); + + return !!1 if $self->SUPER::is_a_type_of($other); + + for my $tc (@{ $self->type_constraints }) { + return !!0 unless $tc->is_a_type_of($other); + } + return !!1; +} + +sub is_subtype_of +{ + my ($self, $other) = Type::Tiny::_loose_to_TypeTiny(@_); + return unless blessed($self) && $self->isa("Type::Tiny"); + return unless blessed($other) && $other->isa("Type::Tiny"); + + return !!1 if $self->SUPER::is_subtype_of($other); + + for my $tc (@{ $self->type_constraints }) { + return !!0 unless $tc->is_subtype_of($other); + } + return !!1; +} + +sub is_supertype_of +{ + my ($self, $other) = Type::Tiny::_loose_to_TypeTiny(@_); + return unless blessed($self) && $self->isa("Type::Tiny"); + return unless blessed($other) && $other->isa("Type::Tiny"); + + return !!1 if $self->SUPER::is_supertype_of($other); + + for my $tc (@{ $self->type_constraints }) { + return !!1 if $tc->equals($other); + return !!1 if $tc->is_supertype_of($other); + } + return !!0; +} + 1; __END__ -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libtype-tiny-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits
