added check for same variable
This commit is contained in:
parent
57c7104bf3
commit
fe6d9cc446
@ -32,6 +32,8 @@ def find_subst(ctx: dict[str, Type],
|
||||
else:
|
||||
if a not in b.constraints:
|
||||
return f"{b} cannot take value of {a}"
|
||||
if a == b:
|
||||
return sub
|
||||
if b in a.get_vars():
|
||||
return "Recursive type is not supported"
|
||||
sub[b.name] = a
|
||||
|
@ -53,6 +53,7 @@ try_case(ListType(i32), ListType(i32), {})
|
||||
try_case(TupleType([X, X]), TupleType([X, Y]), {})
|
||||
try_case(TupleType([X, X]), TupleType([Y, Y]), {})
|
||||
try_case(TupleType([X, Y]), TupleType([X, X]), {})
|
||||
try_case(TupleType([X, X]), TupleType([X, X]), {})
|
||||
try_case(TupleType([X, Y]), X, {})
|
||||
try_case(TupleType([i32, Y]), X, {})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user