From: gfx <gfuji@cpan.org>
Date: Wed, 7 Oct 2009 11:26:05 +0000 (+0900)
Subject: Canonicalize the name of union types
X-Git-Tag: 0.37_03~9
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=30b28db360894f79271c863e40232c5f6417eb51;p=gitmo%2FMouse.git

Canonicalize the name of union types
---

diff --git a/lib/Mouse/Util/TypeConstraints.pm b/lib/Mouse/Util/TypeConstraints.pm
index 85b5698..cee7f5e 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(