This commit is contained in:
Mylloon 2023-12-05 13:52:52 +01:00
parent 756ede6179
commit ab4f675239
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -128,7 +128,7 @@ and synth_tagged
(fun x -> HopixTypes.internalize_ty tenv x) (fun x -> HopixTypes.internalize_ty tenv x)
(match tlist with (match tlist with
| Some t -> t | Some t -> t
| None -> HopixTypes.type_error cons.position "No types found") | None -> HopixTypes.type_error cons.position "No types found.")
in in
let tcons = let tcons =
try HopixTypes.instantiate_type_scheme cons_scheme tys with try HopixTypes.instantiate_type_scheme cons_scheme tys with
@ -165,7 +165,7 @@ and synth_apply
let given = synth_expression tenv x in let given = synth_expression tenv x in
check_equal_types x.position ~expected ~given; check_equal_types x.position ~expected ~given;
droit droit
| _ -> HopixTypes.type_error f.position "Can't apply" | _ -> HopixTypes.type_error f.position "Can't apply."
and synth_record and synth_record
: HopixTypes.typing_environment : HopixTypes.typing_environment
@ -181,7 +181,7 @@ and synth_record
let tlist' = let tlist' =
match tlist with match tlist with
| Some tlist -> List.map (fun t -> HopixTypes.internalize_ty tenv t) tlist | Some tlist -> List.map (fun t -> HopixTypes.internalize_ty tenv t) tlist
| None -> HopixTypes.type_error fl.position "No types found" | None -> HopixTypes.type_error fl.position "No types found."
in in
(* Type checking *) (* Type checking *)
List.iter List.iter
@ -234,7 +234,7 @@ and synth_sequence
= =
fun tenv elist -> fun tenv elist ->
match elist with match elist with
| [] -> HopixTypes.type_error Position.dummy "Invalid sequence" | [] -> HopixTypes.type_error Position.dummy "Invalid sequence."
| [ x ] -> synth_expression tenv x | [ x ] -> synth_expression tenv x
| x :: l -> | x :: l ->
let given = synth_expression tenv x in let given = synth_expression tenv x in
@ -339,7 +339,7 @@ and check_value_definition
fun env -> function fun env -> function
| SimpleValue (id, ty, ex) -> | SimpleValue (id, ty, ex) ->
(match ty with (match ty with
| None -> HopixTypes.type_error ex.position "Type is missing" | None -> HopixTypes.type_error ex.position "Type is missing."
| Some ty' -> | Some ty' ->
let tys, tenv = Position.located_pos (check_type_scheme env) ty' in let tys, tenv = Position.located_pos (check_type_scheme env) ty' in
check_expression tenv ex (HopixTypes.instantiate_type_scheme tys []); check_expression tenv ex (HopixTypes.instantiate_type_scheme tys []);