Skip to content

Commit 6a6e047

Browse files
committed
more tests
1 parent 82ddb31 commit 6a6e047

File tree

6 files changed

+43
-15
lines changed

6 files changed

+43
-15
lines changed

jscomp/syntax/ast_tuple_pattern_flatten.ml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type whole =
3434
(Asttypes.override_flag * Longident.t Asttypes.loc * loc *
3535
Parsetree.attributes)
3636

37-
type acc = whole list
37+
type wholes = whole list
3838

3939
let rec is_simple_pattern (p : Parsetree.pattern) =
4040
match p.ppat_desc with
@@ -43,14 +43,17 @@ let rec is_simple_pattern (p : Parsetree.pattern) =
4343
| Ppat_constraint(p,_) -> is_simple_pattern p
4444
| _ -> false
4545

46+
type destruct_output =
47+
exp list
48+
4649
(**
4750
destruct such pattern
4851
{[ A.B.let open C in (a,b)]}
4952
*)
5053
let rec destruct_open_tuple
5154
(e : Parsetree.expression)
5255
(acc : whole list)
53-
: (_ * Parsetree.expression list * _) option =
56+
: (wholes * destruct_output * _) option =
5457
match e.pexp_desc with
5558
| Pexp_open (flag, lid, cont)
5659
->

jscomp/test/pipe_syntax.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ function f2(a, b, c, d) {
4040
return u + v | 0;
4141
}
4242

43-
function f3(a, b, c, d) {
43+
function f3(a, b, c, d, e) {
4444
var __ocaml_internal_obj = Curry._1(a, b);
45-
var u = Curry._1(c, __ocaml_internal_obj);
46-
var v = Curry._1(d, __ocaml_internal_obj);
47-
return u + v | 0;
45+
var u = Curry._2(c, __ocaml_internal_obj, d);
46+
var v = Curry._3(d, __ocaml_internal_obj, 1, 2);
47+
var h = Curry._1(e, __ocaml_internal_obj);
48+
return (u + v | 0) + h | 0;
4849
}
4950

5051
function f4(a, b, c) {
@@ -54,6 +55,13 @@ function f4(a, b, c) {
5455
];
5556
}
5657

58+
function f5(a, b, c, d) {
59+
var v0 = Curry._3(b, a, c, c);
60+
var v1 = Curry._3(b, a, c, c);
61+
var v2 = Curry._3(b, a, d, d);
62+
return (v0 + v1 | 0) + v2 | 0;
63+
}
64+
5765
exports.t0 = t0;
5866
exports.t1 = t1;
5967
exports.t2 = t2;
@@ -63,4 +71,5 @@ exports.f1 = f1;
6371
exports.f2 = f2;
6472
exports.f3 = f3;
6573
exports.f4 = f4;
74+
exports.f5 = f5;
6675
/* No side effect */

jscomp/test/pipe_syntax.ml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,17 @@ let f2 a b c d =
3434
let u,v = (a b) |. (c,d) in
3535
u + v
3636

37-
let f3 a b c d =
37+
let f3 a b c d e =
3838
( a b)
39-
|. (c, d)
40-
|. (fun (u,v) -> u + v)
39+
|. (c d, d 1 2, e)
40+
|. (fun (u,v,h) -> u + v + h)
4141

4242
let f4 a b c =
4343
a |. (b c , b c )
44+
45+
let f5 a b c d =
46+
let v0, v1, v2 =
47+
a
48+
|. (b c c, b c c, b d d) in
49+
v0 + v1 + v2
50+

lib/bsdep.ml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35932,7 +35932,7 @@ type whole =
3593235932
(Asttypes.override_flag * Longident.t Asttypes.loc * loc *
3593335933
Parsetree.attributes)
3593435934

35935-
type acc = whole list
35935+
type wholes = whole list
3593635936

3593735937
let rec is_simple_pattern (p : Parsetree.pattern) =
3593835938
match p.ppat_desc with
@@ -35941,14 +35941,17 @@ let rec is_simple_pattern (p : Parsetree.pattern) =
3594135941
| Ppat_constraint(p,_) -> is_simple_pattern p
3594235942
| _ -> false
3594335943

35944+
type destruct_output =
35945+
exp list
35946+
3594435947
(**
3594535948
destruct such pattern
3594635949
{[ A.B.let open C in (a,b)]}
3594735950
*)
3594835951
let rec destruct_open_tuple
3594935952
(e : Parsetree.expression)
3595035953
(acc : whole list)
35951-
: (_ * Parsetree.expression list * _) option =
35954+
: (wholes * destruct_output * _) option =
3595235955
match e.pexp_desc with
3595335956
| Pexp_open (flag, lid, cont)
3595435957
->

lib/bsppx.ml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17937,7 +17937,7 @@ type whole =
1793717937
(Asttypes.override_flag * Longident.t Asttypes.loc * loc *
1793817938
Parsetree.attributes)
1793917939

17940-
type acc = whole list
17940+
type wholes = whole list
1794117941

1794217942
let rec is_simple_pattern (p : Parsetree.pattern) =
1794317943
match p.ppat_desc with
@@ -17946,14 +17946,17 @@ let rec is_simple_pattern (p : Parsetree.pattern) =
1794617946
| Ppat_constraint(p,_) -> is_simple_pattern p
1794717947
| _ -> false
1794817948

17949+
type destruct_output =
17950+
exp list
17951+
1794917952
(**
1795017953
destruct such pattern
1795117954
{[ A.B.let open C in (a,b)]}
1795217955
*)
1795317956
let rec destruct_open_tuple
1795417957
(e : Parsetree.expression)
1795517958
(acc : whole list)
17956-
: (_ * Parsetree.expression list * _) option =
17959+
: (wholes * destruct_output * _) option =
1795717960
match e.pexp_desc with
1795817961
| Pexp_open (flag, lid, cont)
1795917962
->

lib/whole_compiler.ml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110481,7 +110481,7 @@ type whole =
110481110481
(Asttypes.override_flag * Longident.t Asttypes.loc * loc *
110482110482
Parsetree.attributes)
110483110483

110484-
type acc = whole list
110484+
type wholes = whole list
110485110485

110486110486
let rec is_simple_pattern (p : Parsetree.pattern) =
110487110487
match p.ppat_desc with
@@ -110490,14 +110490,17 @@ let rec is_simple_pattern (p : Parsetree.pattern) =
110490110490
| Ppat_constraint(p,_) -> is_simple_pattern p
110491110491
| _ -> false
110492110492

110493+
type destruct_output =
110494+
exp list
110495+
110493110496
(**
110494110497
destruct such pattern
110495110498
{[ A.B.let open C in (a,b)]}
110496110499
*)
110497110500
let rec destruct_open_tuple
110498110501
(e : Parsetree.expression)
110499110502
(acc : whole list)
110500-
: (_ * Parsetree.expression list * _) option =
110503+
: (wholes * destruct_output * _) option =
110501110504
match e.pexp_desc with
110502110505
| Pexp_open (flag, lid, cont)
110503110506
->

0 commit comments

Comments
 (0)