programs: fixed typing error messages

parent aa179fd0
......@@ -61,7 +61,7 @@ let rec print_dty fmt = function
| Tyvar { type_val = Some t } ->
print_dty fmt t
| Tyvar { type_val = None; tvsymbol = v } ->
fprintf fmt "'%s" v.tv_name.id_string
Pretty.print_tv fmt v
| Tyapp (s, []) ->
fprintf fmt "%s" s.ts_name.id_string
| Tyapp (s, [t]) ->
......
......@@ -208,7 +208,7 @@ let uncurrying ty =
let expected_type e ty =
if not (Denv.unify e.dexpr_type ty) then
errorm ~loc:e.dexpr_loc
"this expression has type %a, but is expected to have type %a"
"@[this expression has type %a,@ but is expected to have type %a@]"
print_dty e.dexpr_type print_dty ty
let check_mutable_type loc dty = match view_dty dty with
......@@ -216,7 +216,7 @@ let check_mutable_type loc dty = match view_dty dty with
()
| _ ->
errorm ~loc
"this expression has type %a, but is expected to have a mutable type"
"@[this expression has type %a,@ but is expected to have a mutable type@]"
print_dty dty
let dexception uc qid =
......@@ -226,7 +226,7 @@ let dexception uc qid =
let ty_exn = dty_app (ts_exn, []) in
if not (Denv.unify ty ty_exn) then
errorm ~loc
"this expression has type %a, but is expected to be an exception"
"@[this expression has type %a,@ but is expected to be an exception@]"
print_dty ty;
r
......@@ -575,7 +575,7 @@ and dletrec ~ghost env dl =
let ty = dcurrying tyl e.dexpr_type in
if not (Denv.unify ty tyres) then
errorm ~loc:id.id_loc
"this expression has type %a, but is expected to have type %a"
"@[this expression has type %a,@ but is expected to have type %a@]"
print_dty ty print_dty tyres;
((id, tyres), bl, v, t)
in
......@@ -713,7 +713,7 @@ let iuregion env ({ pp_loc = loc; pp_desc = d } as t) = match d with
| _ ->
let ty = type_effect_term env t in
let not_mutable () = errorm ~loc
"this expression has type %a,@ but is expected to have a mutable type@]"
"@[this expression has type %a,@ but is expected to have a mutable type@]"
Pretty.print_ty ty
in
begin match ty.ty_node with
......
module M
use import int.Int
use import module stdlib.Ref
let test1 () =
let x = ref 0 in
while True do
invariant { 0 <= x }
x := !x + 1
done
use import int.Int
type t = {| mutable a: int; mutable b: int |}
let test (x: t) =
a x = b x
let foo (x: t) =
test x
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment