This commit is contained in:
Mylloon 2023-12-05 19:45:57 +01:00
parent 0ec66864fb
commit 6bbb1f0996
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -90,16 +90,17 @@ and synth_pattern
: HopixTypes.typing_environment -> HopixAST.pattern Position.located
-> HopixTypes.aty * HopixTypes.typing_environment
=
fun env Position.{ value = p; position = pos } -> match p with
| PWildcard -> failwith "PWildcard"
| PLiteral l-> failwith "Pliteral"
| PVariable pv -> failwith "PVariable"
| PTypeAnnotation(p,ty) -> failwith "PTypeAnnot"
| PTuple(plist) -> failwith "PTuple"
| POr(plist) -> failwith "POr"
| PAnd (plist) -> failwith "PAnd"
| PTaggedValue(cons,tlist,plist) -> failwith "PTagged"
| PRecord(plist,tlist) -> failwith "PRecord"
fun env Position.{ value = p; position = pos } ->
match p with
| PWildcard -> failwith "synth_pattern | PWildcard"
| PLiteral l -> failwith "synth_pattern | Pliteral"
| PVariable pv -> failwith "synth_pattern | PVariable"
| PTypeAnnotation (p, ty) -> failwith "synth_pattern | PTypeAnnot"
| PTuple plist -> failwith "synth_pattern | PTuple"
| POr plist -> failwith "synth_pattern | POr"
| PAnd plist -> failwith "synth_pattern | PAnd"
| PTaggedValue (cons, tlist, plist) -> failwith "synth_pattern | PTagged"
| PRecord (plist, tlist) -> failwith "synth_pattern | PRecord"
and synth_variable
: HopixTypes.typing_environment -> identifier Position.located
@ -215,9 +216,9 @@ and synth_fun
-> expression Position.located -> HopixTypes.aty
=
fun tenv pat expr ->
let pat_type, tenv = synth_pattern tenv pat in
let expr_type = synth_expression tenv expr in
ATyArrow(pat_type,expr_type)
let pat_type, tenv = synth_pattern tenv pat in
let expr_type = synth_expression tenv expr in
ATyArrow (pat_type, expr_type)
and synth_tannot
: HopixTypes.typing_environment -> expression Position.located -> ty Position.located
@ -233,7 +234,10 @@ and synth_field
: HopixTypes.typing_environment -> expression Position.located
-> label Position.located -> ty Position.located list option -> HopixTypes.aty
=
fun tenv expr lbl tlist -> failwith "synth_field" (*let expr_type = synth_expression tenv expr in
fun tenv expr lbl tlist ->
(* TODO *)
failwith "synth_field"
(*let expr_type = synth_expression tenv expr in
match expr_type with
| ATyCon(cons,atlist) ->
(
@ -256,12 +260,13 @@ and synth_field
)
| _ -> failwith "Ceci n'est pas un label"
*)
and synth_tuple
: HopixTypes.typing_environment -> expression Position.located list -> HopixTypes.aty
=
fun tenv elist -> let list_type = List.map(
fun x -> synth_expression tenv x
) elist in HopixTypes.ATyTuple(list_type)
fun tenv elist ->
let list_type = List.map (fun x -> synth_expression tenv x) elist in
HopixTypes.ATyTuple list_type
and synth_sequence
: HopixTypes.typing_environment -> expression Position.located list -> HopixTypes.aty