Skip to content

Commit cad75c0

Browse files
committed
Use already implemented function to get type variable assignments
1 parent a7d38ba commit cad75c0

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/ir/type_utils.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ def _replace_type_argument(base_targ: tp.Type, bound: tp.Type, types,
5353
base_targ.t_constructor, types, only_regular=True,
5454
type_var_map=type_var_map, variance_choices=None
5555
)
56-
type_var_map = {
57-
t_param: base_targ.type_args[i]
58-
for i, t_param in enumerate(
59-
base_targ.t_constructor.type_parameters)
60-
}
56+
type_var_map = new_targ.get_type_variable_assignments()
6157
return base_targ.to_variance_free(type_var_map)
6258

6359
# Here, we have a case like the following.
@@ -101,7 +97,7 @@ def _find_candidate_type_args(t_param: tp.TypeParameter,
10197
bound = tp.substitute_type(t_param.bound, type_var_map)
10298

10399
if bound and bound.is_parameterized():
104-
# If bound is `paramterized`, we seek another type argument that
100+
# If bound is `parameterized`, we seek for another type argument that
105101
# is subtype of the the `new` bound.
106102
base_targ = _replace_type_argument(base_targ, bound, types,
107103
t_param.bound.has_type_variables())

0 commit comments

Comments
 (0)