@@ -17,7 +17,7 @@ def __str__(self) -> str:
1717 raise Exception ("Complex type must be put through render_type_expr!" )
1818
1919 def __eq__ (self , other : object ) -> bool :
20- return isinstance (other , TypeName ) and other . value == self . value
20+ return isinstance (other , TypeName ) and hash ( self ) == hash ( other )
2121
2222 def __lt__ (self , other : object ) -> bool :
2323 return hash (self ) < hash (other )
@@ -29,7 +29,7 @@ def __str__(self) -> str:
2929 raise Exception ("Complex type must be put through render_type_expr!" )
3030
3131 def __eq__ (self , other : object ) -> bool :
32- return isinstance (other , NoneTypeExpr )
32+ return isinstance (other , NoneTypeExpr ) and hash ( self ) == hash ( other )
3333
3434 def __lt__ (self , other : object ) -> bool :
3535 return hash (self ) < hash (other )
@@ -43,7 +43,7 @@ def __str__(self) -> str:
4343 raise Exception ("Complex type must be put through render_type_expr!" )
4444
4545 def __eq__ (self , other : object ) -> bool :
46- return isinstance (other , DictTypeExpr ) and other . nested == self . nested
46+ return isinstance (other , DictTypeExpr ) and hash ( self ) == hash ( other )
4747
4848 def __lt__ (self , other : object ) -> bool :
4949 return hash (self ) < hash (other )
@@ -57,7 +57,7 @@ def __str__(self) -> str:
5757 raise Exception ("Complex type must be put through render_type_expr!" )
5858
5959 def __eq__ (self , other : object ) -> bool :
60- return isinstance (other , ListTypeExpr ) and other . nested == self . nested
60+ return isinstance (other , ListTypeExpr ) and hash ( self ) == hash ( other )
6161
6262 def __lt__ (self , other : object ) -> bool :
6363 return hash (self ) < hash (other )
@@ -71,7 +71,7 @@ def __str__(self) -> str:
7171 raise Exception ("Complex type must be put through render_type_expr!" )
7272
7373 def __eq__ (self , other : object ) -> bool :
74- return isinstance (other , LiteralTypeExpr ) and other . nested == self . nested
74+ return isinstance (other , LiteralTypeExpr ) and hash ( self ) == hash ( other )
7575
7676 def __lt__ (self , other : object ) -> bool :
7777 return hash (self ) < hash (other )
@@ -85,9 +85,7 @@ def __str__(self) -> str:
8585 raise Exception ("Complex type must be put through render_type_expr!" )
8686
8787 def __eq__ (self , other : object ) -> bool :
88- return isinstance (other , UnionTypeExpr ) and set (other .nested ) == set (
89- self .nested
90- )
88+ return isinstance (other , UnionTypeExpr ) and hash (self ) == hash (other )
9189
9290 def __lt__ (self , other : object ) -> bool :
9391 return hash (self ) < hash (other )
@@ -101,7 +99,7 @@ def __str__(self) -> str:
10199 raise Exception ("Complex type must be put through render_type_expr!" )
102100
103101 def __eq__ (self , other : object ) -> bool :
104- return isinstance (other , OpenUnionTypeExpr ) and other . union == self . union
102+ return isinstance (other , OpenUnionTypeExpr ) and hash ( self ) == hash ( other )
105103
106104 def __lt__ (self , other : object ) -> bool :
107105 return hash (self ) < hash (other )
0 commit comments