explicit types

This commit is contained in:
Mylloon 2023-12-05 20:51:23 +01:00
parent a6f8ea69d0
commit 1eab8ed491
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -92,15 +92,66 @@ and synth_pattern
= =
fun env Position.{ value = p; position = pos } -> fun env Position.{ value = p; position = pos } ->
match p with match p with
| PWildcard -> failwith "synth_pattern | PWildcard" | PWildcard -> pattern_wildcard pos
| PLiteral l -> failwith "synth_pattern | Pliteral" | PLiteral l -> pattern_literal env l
| PVariable pv -> failwith "synth_pattern | PVariable" | PVariable _ -> pattern_variable pos
| PTypeAnnotation (p, ty) -> failwith "synth_pattern | PTypeAnnot" | PTypeAnnotation (p, ty) -> pattern_tannot env p ty
| PTuple plist -> failwith "synth_pattern | PTuple" | PTuple plist -> pattern_tuple env plist
| POr plist -> failwith "synth_pattern | POr" | POr plist -> pattern_or env plist
| PAnd plist -> failwith "synth_pattern | PAnd" | PAnd plist -> pattern_and env plist
| PTaggedValue (cons, tlist, plist) -> failwith "synth_pattern | PTagged" | PTaggedValue (cons, tlist, plist) -> pattern_tagval env cons tlist plist
| PRecord (plist, tlist) -> failwith "synth_pattern | PRecord" | PRecord (plist, tlist) -> pattern_record env plist tlist
and pattern_wildcard : Position.t -> HopixTypes.aty * HopixTypes.typing_environment =
fun pos -> HopixTypes.type_error pos "No types found."
and pattern_literal
: HopixTypes.typing_environment -> HopixAST.literal Position.located
-> HopixTypes.aty * HopixTypes.typing_environment
=
fun tenv l -> failwith "synth_pattern | Pliteral"
and pattern_variable : Position.t -> HopixTypes.aty * HopixTypes.typing_environment =
fun pos -> HopixTypes.type_error pos "No types found."
and pattern_tannot
: HopixTypes.typing_environment -> HopixAST.pattern Position.located
-> HopixAST.ty Position.located -> HopixTypes.aty * HopixTypes.typing_environment
=
fun tenv p ty -> failwith "synth_pattern | PTypeAnnot"
and pattern_tuple
: HopixTypes.typing_environment -> HopixAST.pattern Position.located list
-> HopixTypes.aty * HopixTypes.typing_environment
=
fun tenv plist -> failwith "synth_pattern | PTuple"
and pattern_or
: HopixTypes.typing_environment -> HopixAST.pattern Position.located list
-> HopixTypes.aty * HopixTypes.typing_environment
=
fun tenv plist -> failwith "synth_pattern | POr"
and pattern_and
: HopixTypes.typing_environment -> HopixAST.pattern Position.located list
-> HopixTypes.aty * HopixTypes.typing_environment
=
fun tenv plist -> failwith "synth_pattern | PAnd"
and pattern_tagval
: HopixTypes.typing_environment -> HopixAST.constructor Position.located
-> HopixAST.ty Position.located list option -> HopixAST.pattern Position.located list
-> HopixTypes.aty * HopixTypes.typing_environment
=
fun tenv cons tlist plist -> failwith "synth_pattern | PTagged"
and pattern_record
: HopixTypes.typing_environment
-> (HopixAST.label Position.located * HopixAST.pattern Position.located) list
-> HopixAST.ty Position.located list option
-> HopixTypes.aty * HopixTypes.typing_environment
=
fun tenv plist tlist -> failwith "synth_pattern | PRecord"
and synth_variable and synth_variable
: HopixTypes.typing_environment -> identifier Position.located : HopixTypes.typing_environment -> identifier Position.located