mukul-rathi / bolt

Bolt is a language with in-built data-race freedom!
MIT License
573 stars 53 forks source link

Shift borrow checking to data-race typechecker #127

Closed mukul-rathi closed 4 years ago

mukul-rathi commented 4 years ago

Before I'd associated it with TEClass which was a bit of technical debt to ease implementation, but need to split DR checking from core lang checking completely

(* Can't assign a borrowed expr to a variable *)
let check_expr_not_borrowed type_expr loc =
  match type_expr with
  | TEClass (class_name, Borrowed) ->
    Error
      (Error.of_string
         (Fmt.str "%s Type error: can't assign expr of type %s as it is borrowed."
            (string_of_loc loc)
            (Class_name.to_string class_name)))
  | _ -> Ok ()

This ^ should go in DR checker