let type_var_assign vasgn env = match vasgn with
Ast.SynVarAssignment (var,vprod) ->
let var_type, temp_env = type_variable_identifier var env in
let vp_type, new_env = type_value_producer vprod temp_env in
if vp_type = var_type or TyRef vp_type = var_type then
TyVoid, new_env
else
raise_type_error ["Cannot assign a value of type ";string_of_type vp_type;" to something of type ";string_of_type var_type;"."]
| Ast.SynVarModify (vident, op, vprod) ->
let var_type, temp_env = type_variable_identifier vident env in
let vp_type, new_env = type_value_producer vprod temp_env in
let t1, t2 =
(match op with
Ast.SynBinopCons -> vp_type, var_type
| _ -> var_type, vp_type)
in
if isallowed_binop op t1 t2 then
TyVoid, new_env
else
raise_type_error ["Cannot use operator ";Ast.string_of_binop op;" to mutate a value of type ";string_of_type var_type;" with an argument of type ";string_of_type vp_type;"."]