use warnings;
use metaclass;
-our $VERSION = '0.59';
+our $VERSION = '0.68';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
my ($self, $type_parameter) = @_;
my $contained_tc = $self->_parse_type_parameter($type_parameter);
+
+ ## The type parameter should be a subtype of the parent's type parameter
+ ## if there is one.
+
+ if(my $parent = $self->parent) {
+ if($parent->can('type_parameter')) {
+ $contained_tc->is_a_type_of($parent->type_parameter)
+ || Moose->throw_error("$type_parameter is not a subtype of ".$parent->type_parameter);
+ }
+ }
if ( $contained_tc->isa('Moose::Meta::TypeConstraint') ) {
my $tc_name = $self->name . '[' . $contained_tc->name . ']';
=item B<parameterize>
-Given a single type constraint string, this method parses the string
-and parameterizes the type based on the parsed string.
+Given a single type constraint or type constraint string, this method
+parameterizes the type based on the given argument.
=item B<meta>
=head1 COPYRIGHT AND LICENSE
-Copyright 2006-2008 by Infinity Interactive, Inc.
+Copyright 2006-2009 by Infinity Interactive, Inc.
L<http://www.iinteractive.com>