hylo icon indicating copy to clipboard operation
hylo copied to clipboard

Overlapping mutable access to expressions during type checking

Open kyouko-taiga opened this issue 3 years ago • 0 comments

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.

kyouko-taiga avatar Aug 12 '21 19:08 kyouko-taiga