nested app
This commit is contained in:
parent
dc1efb51e2
commit
fb7fc53863
2 changed files with 13 additions and 5 deletions
|
@ -58,12 +58,13 @@ let typeof t =
|
|||
(* Nested *)
|
||||
nested_infer env env' ty_fn
|
||||
| None -> None, env)
|
||||
(* | (Some (Type.Var _ as ty1), _), _ ->
|
||||
| (Some (Type.Var _ as ty1), _), _ ->
|
||||
(* On this case we may have a function represented as a variable *)
|
||||
(* TODO: Nested application *)
|
||||
let ty2 = Type.Arrow (ty1, ty1) in
|
||||
(match Unification.unify ty1 ty2 with
|
||||
| Some env' -> Some ty2, env'
|
||||
| _ -> None, env) *)
|
||||
| _ -> None, env)
|
||||
| _ -> None, env)
|
||||
in
|
||||
fst (infer TypeSubstitution.empty t)
|
||||
|
|
|
@ -62,6 +62,13 @@ let tests_typeof =
|
|||
( Fun (x, Proj (First, Proj (Second, Var x)))
|
||||
, Pair (Pair (IntConst 1, IntConst 2), IntConst 3) ))
|
||||
, Some Type.Int )
|
||||
(* ; (* x -> y -> (x -> y -> z) -> z *)
|
||||
( "fun x -> fun y -> fun z -> z x y"
|
||||
, Term.(Fun (x, Fun (y, Fun (z, App (Var z, App (Var x, Var y))))))
|
||||
, Some
|
||||
Type.(
|
||||
Arrow (Var x, Arrow (Var y, Arrow (Arrow (Var x, Arrow (Var y, Var z)), Var z))))
|
||||
) *)
|
||||
]
|
||||
;;
|
||||
|
||||
|
|
Reference in a new issue