X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FUtil%2FTypeConstraints.pm;h=c84c75cbd375cce7e43ae0b05992c92e55f69309;hb=9f74c4013f93b795e432e1818c3ebf13f5afb9f0;hp=85b5698c5b369e0fd430cb927bf590d885cc4f3c;hpb=bc69ee88207ce5c53f5c02dbd44cfabfbe6bae70;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Util/TypeConstraints.pm b/lib/Mouse/Util/TypeConstraints.pm index 85b5698..c84c75c 100644 --- a/lib/Mouse/Util/TypeConstraints.pm +++ b/lib/Mouse/Util/TypeConstraints.pm @@ -303,9 +303,9 @@ sub _find_or_create_parameterized_type{ } } sub _find_or_create_union_type{ - my @types = map{ $_->{type_constraints} ? @{$_->{type_constraints}} : $_ } @_; + my @types = sort{ $a cmp $b } map{ $_->{type_constraints} ? @{$_->{type_constraints}} : $_ } @_; - my $name = join '|', map{ $_->name } @types; + my $name = join '|', @types; $TYPE{$name} ||= do{ return Mouse::Meta::TypeConstraint->new( @@ -398,7 +398,7 @@ sub find_or_parse_type_constraint { } sub find_or_create_does_type_constraint{ - my $type = find_or_parse_type_constriant(@_) || role_type(@_); + my $type = find_or_parse_type_constraint(@_) || role_type(@_); if($type->{type} && $type->{type} ne 'Role'){ Carp::cluck("$type is not a role type");