fix typing errors

This commit is contained in:
adelaett 2023-03-31 16:01:05 +02:00
parent 573df8416f
commit e9ead93f3f
8 changed files with 12 additions and 26 deletions

View File

@ -325,7 +325,8 @@ and evaluate_operator :
| Lte_mon_mon | Lte_dat_dat | Lte_dur_dur | Gt_int_int | Gt_rat_rat
| Gt_mon_mon | Gt_dat_dat | Gt_dur_dur | Gte_int_int | Gte_rat_rat
| Gte_mon_mon | Gte_dat_dat | Gte_dur_dur | Eq_int_int | Eq_rat_rat
| Eq_mon_mon | Eq_dat_dat | Eq_dur_dur ),
| Eq_mon_mon | Eq_dat_dat | Eq_dur_dur | HandleDefault
| HandleDefaultOpt ),
_ ) ->
err ()

View File

@ -193,8 +193,7 @@ let trans_var ctx (x : 'm D.expr Var.t) : 'm Ast.expr Var.t =
new_; *)
new_
let trans_op : type m. (dcalc, m) Op.t -> (lcalc, m) Op.t =
fun op -> Operator.translate None op
let trans_op : dcalc Op.t -> lcalc Op.t = fun op -> Operator.translate op
let rec trans ctx (e : 'm D.expr) : (lcalc, 'm mark) boxed_gexpr =
let m = Marked.get_mark e in

View File

@ -147,8 +147,7 @@ let mark_pos (type m) (m : m mark) : Pos.t =
let pos (type m) (x : ('a, m mark) Marked.t) : Pos.t =
mark_pos (Marked.get_mark x)
let eid mark :
([< `Dcalc | `Desugared | `Lcalc | `Scopelang ], 'a mark) boxed_gexpr =
let eid mark : ('a any, 'm mark) boxed_gexpr =
let x = Var.make "x" in
eabs (bind [| x |] (evar x mark)) [TAny, mark_pos mark] mark

View File

@ -139,9 +139,7 @@ val escopecall :
't ->
(([< all > `ExplicitScopes ] as 'a), 't) boxed_gexpr
val eid :
'a mark ->
([< `Dcalc | `Desugared | `Lcalc | `Scopelang ], 'a mark) boxed_gexpr
val eid : 'm mark -> ('a any, 'm mark) boxed_gexpr
(** Manipulation of marks *)

View File

@ -41,7 +41,4 @@ val equal :
bool
val format :
?debug:bool ->
Format.formatter ->
([< `Dcalc | `Desugared | `Lcalc | `Scopelang ], 'a mark) gexpr program ->
unit
?debug:bool -> Format.formatter -> ('a any, 'm mark) gexpr program -> unit

View File

@ -197,9 +197,10 @@ let rec format_scope_body_expr ?(debug = false) ctx fmt b : unit =
Format.fprintf fmt "@[<hov 2>%a %a %a %a %a %a@; %a @;%a @]@,%a"
Print.keyword "let"
(format_scope_let_kind ~debug ctx)
scope_let_kind (if debug then Print.var_debug else Print.var) var Print.punctuation ":" (Print.typ ctx)
scope_let_typ Print.punctuation "=" (Print.expr ~debug ctx) scope_let_expr
Print.keyword "in"
scope_let_kind
(if debug then Print.var_debug else Print.var)
var Print.punctuation ":" (Print.typ ctx) scope_let_typ Print.punctuation
"=" (Print.expr ~debug ctx) scope_let_expr Print.keyword "in"
(format_scope_body_expr ~debug ctx)
next

View File

@ -128,7 +128,7 @@ val code_item_format :
actual term. *) ->
decl_ctx ->
Format.formatter ->
([< `Dcalc | `Desugared | `Lcalc | `Scopelang ], 'a mark) gexpr code_item ->
('a any, 'm mark) gexpr code_item ->
unit
val code_item_list_format :
@ -138,7 +138,7 @@ val code_item_list_format :
actual term. *) ->
decl_ctx ->
Format.formatter ->
([< `Dcalc | `Desugared | `Lcalc | `Scopelang ], 'a mark) gexpr code_item_list ->
('a any, 'm mark) gexpr code_item_list ->
unit
val to_expr :

View File

@ -67,15 +67,6 @@ let rec typ_to_ast ~leave_unresolved (ty : unionfind_typ) : A.typ =
Errors.raise_spanned_error pos
"Internal error: typing at this point could not be resolved"
(* Checks that there are no type variables remaining *)
let rec all_resolved ty =
match Marked.unmark (UnionFind.get (UnionFind.find ty)) with
| TAny _ -> false
| TLit _ | TStruct _ | TEnum _ -> true
| TOption t1 | TArray t1 -> all_resolved t1
| TArrow (t1, t2) -> List.for_all all_resolved t1 && all_resolved t2
| TTuple ts -> List.for_all all_resolved ts
let rec ast_to_typ (ty : A.typ) : unionfind_typ =
let ty' =
match Marked.unmark ty with