This commit is contained in:
Mylloon 2023-12-04 18:38:57 +01:00
parent 97fc6d3d86
commit 72c323b2c8
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -48,8 +48,6 @@ let check_type_scheme
HopixTypes.Scheme (ts, HopixTypes.internalize_ty env ty), env HopixTypes.Scheme (ts, HopixTypes.internalize_ty env ty), env
;; ;;
let rec check_pattern let rec check_pattern
: HopixTypes.typing_environment -> HopixAST.pattern Position.located -> HopixTypes.aty : HopixTypes.typing_environment -> HopixAST.pattern Position.located -> HopixTypes.aty
-> HopixTypes.typing_environment -> HopixTypes.typing_environment
@ -83,7 +81,7 @@ let rec synth_expression
| While (ecase, expr) -> synth_while env ecase expr | While (ecase, expr) -> synth_while env ecase expr
| For (id, ecase, expr1, expr2) -> synth_for env id ecase expr1 expr2 | For (id, ecase, expr1, expr2) -> synth_for env id ecase expr1 expr2
and synth_literal : HopixAST.literal -> HopixTypes.aty = and synth_literal : HopixAST.literal -> HopixTypes.aty =
fun l -> fun l ->
match l with match l with
| LInt _ -> HopixTypes.hint | LInt _ -> HopixTypes.hint
@ -113,17 +111,17 @@ and synth_apply
: HopixTypes.typing_environment -> expression Position.located : HopixTypes.typing_environment -> expression Position.located
-> expression Position.located -> HopixTypes.aty -> expression Position.located -> HopixTypes.aty
= =
fun tenv f x -> (*failwith "Students! This is your job! (synth_apply)"*) fun tenv f x ->
(*failwith "Students! This is your job! (synth_apply)"*)
let f_type = synth_expression tenv f in let f_type = synth_expression tenv f in
match f_type with match f_type with
| HopixTypes.ATyArrow (gauche,droit) -> (* a' -> b' *) | HopixTypes.ATyArrow (gauche, droit) ->
( (* a' -> b' *)
let x_type = synth_expression tenv x in let x_type = synth_expression tenv x in
check_equal_types x.position gauche x_type; droit check_equal_types x.position gauche x_type;
) droit
| _ -> failwith "" | _ -> failwith ""
and synth_record and synth_record
: HopixTypes.typing_environment : HopixTypes.typing_environment
-> (label Position.located * expression Position.located) list -> (label Position.located * expression Position.located) list
@ -208,7 +206,6 @@ and synth_for
= =
fun tenv id estart eend expr -> failwith "Students! This is your job! (synth_for)" fun tenv id estart eend expr -> failwith "Students! This is your job! (synth_for)"
and check_expression and check_expression
: HopixTypes.typing_environment -> HopixAST.expression Position.located : HopixTypes.typing_environment -> HopixAST.expression Position.located
-> HopixTypes.aty -> unit -> HopixTypes.aty -> unit