hylo
hylo copied to clipboard
Overlapping mutable access to expressions during type checking
The interface of the function to type check expression currently expects expr
to be inout
, so that it may be substituted during type checking (e.g., to replace unresolved declaration references).
However, this choice can lead to an overlapping mutable access when we type check pattern bindings, if the initializer refers to the declaration itself, e.g., val x = x
.
This situation is illegal and should be caught during name resolution.
Nonetheless, we should eliminate the possibility of an overlapping access.
The simplest solution is probably to change TypeChecker.check
so that it returns the expression checked, along with the solver's solution.