File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -143,10 +143,15 @@ def visit_instance(self, left: Instance) -> bool:
143
143
rname = right .type .fullname ()
144
144
if not left .type .has_base (rname ) and rname != 'builtins.object' :
145
145
return False
146
-
147
146
# Map left type to corresponding right instances.
148
147
t = map_instance_to_supertype (left , right .type )
149
-
148
+ # Check that one of the types does not have type args or
149
+ # the number of type args is the same and
150
+ # each left type arg is acceptable in place of the matching right one
151
+ if not t .args or not right .args :
152
+ return True
153
+ if len (t .args ) != len (right .args ):
154
+ return False
150
155
return all (self .check_type_parameter (lefta , righta , tvar .variance )
151
156
for lefta , righta , tvar in
152
157
zip (t .args , right .args , right .type .defn .type_vars ))
Original file line number Diff line number Diff line change @@ -1428,7 +1428,7 @@ def visit_tuple_type(self, t: TupleType) -> str:
1428
1428
s = self .list_str (t .items )
1429
1429
if t .fallback and t .fallback .type :
1430
1430
fallback_name = t .fallback .type .fullname ()
1431
- if fallback_name != 'builtins.tuple' :
1431
+ if fallback_name not in ( 'builtins.tuple' , 'builtins.object' ) :
1432
1432
return 'Tuple[{}, fallback={}]' .format (s , t .fallback .accept (self ))
1433
1433
return 'Tuple[{}]' .format (s )
1434
1434
You can’t perform that action at this time.
0 commit comments