synth_assign

This commit is contained in:
Mylloon 2023-12-05 04:08:51 +01:00
parent 0fb9b8603b
commit f82e28cd8b
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -191,7 +191,13 @@ and synth_assign
: HopixTypes.typing_environment -> expression Position.located
-> expression Position.located -> HopixTypes.aty
=
fun tenv ref expr -> failwith "Students! This is your job! (synth_assign)"
fun tenv ref expr ->
let refty = synth_expression tenv ref in
match HopixTypes.destruct_reference_type expr.position refty with
| expected ->
let given = synth_expression tenv expr in
check_equal_types expr.position ~expected ~given;
HopixTypes.hunit
and synth_read
: HopixTypes.typing_environment -> expression Position.located -> HopixTypes.aty