Skip to content

Commit bb6ec2e

Browse files
committed
Do not add self to supertypes
1 parent 5085a9b commit bb6ec2e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ir/type_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ class B : A<String>()
10451045
if not same_type and t1.name != t2.name and not t2.is_type_var():
10461046
if not t1.supertypes:
10471047
return {}
1048-
supertype = t1.supertypes[0]
1048+
supertype = t1.supertypes[-1]
10491049
return unify_types(supertype, t2, factory, same_type=same_type)
10501050

10511051
is_type_var = isinstance(t1, tp.TypeParameter)
@@ -1196,7 +1196,7 @@ def replace_targ(targ, type_var_map):
11961196
for targ in sig.type_args]
11971197
return sig
11981198
if cls_decl.supertypes:
1199-
return find_sam_fun_signature(context, cls_decl.supertypes[0],
1199+
return find_sam_fun_signature(context, cls_decl.supertypes[-1],
12001200
get_function_type)
12011201
return None
12021202

@@ -1336,7 +1336,7 @@ def _to_type_var_id(type_con, type_var):
13361336
supertypes = _get_supertypes(t1)
13371337
parent = t1
13381338
while supertypes:
1339-
st = supertypes[0]
1339+
st = supertypes[-1]
13401340
if st.is_parameterized():
13411341
type_deps.update({
13421342
st.name: [_to_type_var_id(st, t_param)

src/ir/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class Builtin(Type):
137137

138138
def __init__(self, name: str):
139139
super().__init__(name)
140-
self.supertypes = [self]
140+
self.supertypes = []
141141

142142
def has_type_variables(self):
143143
return False

0 commit comments

Comments
 (0)