Fix not properly handling function types as arguments.
This commit is contained in:
parent
57caa4ea85
commit
a952cc496d
@ -430,7 +430,18 @@ type_expr_simple:
|
||||
TProd {region = cover $1 $3; value=$2}
|
||||
}
|
||||
| "(" type_expr_simple "=>" type_expr_simple ")" {
|
||||
TFun {region = cover $1 $5; value=$2,$3,$4} }
|
||||
TPar {
|
||||
value = {
|
||||
lpar = $1;
|
||||
rpar = $5;
|
||||
inside = TFun {
|
||||
region = cover (type_expr_to_region $2) (type_expr_to_region $4);
|
||||
value=$2,$3,$4
|
||||
}
|
||||
};
|
||||
region = cover $1 $5;
|
||||
}
|
||||
}
|
||||
|
||||
type_annotation_simple:
|
||||
":" type_expr_simple { $1,$2 }
|
||||
|
@ -50,11 +50,8 @@ and pp_let_binding let_ (binding : let_binding) =
|
||||
| Some (_,e) ->
|
||||
patterns ^^ group (break 0 ^^ string ": " ^^ pp_type_expr e ^^ string " = ")
|
||||
in
|
||||
match let_rhs with
|
||||
(* | EFun { } -> *)
|
||||
| e ->
|
||||
let rhs = pp_expr e
|
||||
in prefix 2 0 lhs rhs
|
||||
let rhs = pp_expr let_rhs
|
||||
in prefix 2 0 lhs rhs
|
||||
|
||||
and pp_pattern = function
|
||||
PConstr p -> pp_pconstr p
|
||||
@ -403,7 +400,7 @@ and pp_seq {value; _} =
|
||||
|
||||
and pp_type_expr = function
|
||||
TProd t -> pp_cartesian t
|
||||
| TSum t -> pp_variants t
|
||||
| TSum t -> break 0 ^^ pp_variants t
|
||||
| TRecord t -> pp_fields t
|
||||
| TApp t -> pp_type_app t
|
||||
| TFun t -> pp_fun_type t
|
||||
|
@ -3,12 +3,12 @@ let foobar =
|
||||
{
|
||||
let foo: int => int = (i: int) => i;
|
||||
let bar: ((int => int) => int) =
|
||||
(f: int => int) => f(i);
|
||||
(f: (int => int)) => f(i);
|
||||
bar(foo)
|
||||
};
|
||||
|
||||
let higher2 =
|
||||
(i: int, f: int => int): int =>
|
||||
(i: int, f: (int => int)): int =>
|
||||
{
|
||||
let ii: int = f(i);
|
||||
ii
|
||||
@ -37,7 +37,7 @@ let g = (i: int): int => f(i);
|
||||
let foobar4 = (i: int): int => g(g(i));
|
||||
|
||||
let higher3 =
|
||||
(i: int, f: int => int, g: int => int): int =>
|
||||
(i: int, f: (int => int), g: (int => int)): int =>
|
||||
{
|
||||
let ii: int = f(g(i));
|
||||
ii
|
||||
|
@ -2,4 +2,4 @@ type storage = unit;
|
||||
|
||||
let main =
|
||||
((a, s): (unit, storage)): unit =>
|
||||
((f: unit => unit) => f(()))((useless: unit) => unit);
|
||||
((f: (unit => unit)) => f(()))((useless: unit) => unit);
|
||||
|
@ -1,6 +1,7 @@
|
||||
type storage = address;
|
||||
|
||||
type parameter = Donate(unit)
|
||||
type parameter =
|
||||
Donate(unit)
|
||||
| Distribute((unit => list(operation)));
|
||||
|
||||
let donate =
|
||||
@ -10,7 +11,7 @@ let donate =
|
||||
};
|
||||
|
||||
let distribute =
|
||||
((p, s): (unit => list(operation), storage))
|
||||
((p, s): ((unit => list(operation)), storage))
|
||||
:
|
||||
(list(operation), storage) =>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user