1
0
Fork 0
This commit is contained in:
Mylloon 2024-04-14 03:14:01 +02:00
parent 91e62c04f6
commit b809467cff
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -35,9 +35,10 @@ let typeof t =
| None, _ -> Some (Type.Arrow (Type.Var id, ty_body)), env')
| _ -> None, env)
| Term.App (t1, t2) ->
(* Check if the function type matches the arguments *)
(* TODO: When a variable is a function *)
(match infer env t1, infer env t2 with
| (Some (Type.Arrow (ty_param, ty_fn)), _), (Some ty_args, _) ->
(* Check if the function type matches the arguments *)
(match Unification.unify ty_param ty_args with
| Some _ -> Some ty_fn, env
| None -> None, env)