File tree Expand file tree Collapse file tree 3 files changed +134
-0
lines changed Expand file tree Collapse file tree 3 files changed +134
-0
lines changed Original file line number Diff line number Diff line change @@ -440,6 +440,7 @@ build test/module_as_function.cmi test/module_as_function.cmj : cc test/module_a
440
440
build test/module_missing_conversion.cmi test/module_missing_conversion.cmj : cc test/module_missing_conversion.ml | $stdlib
441
441
build test/module_parameter_test.cmi test/module_parameter_test.cmj : cc test/module_parameter_test.ml | test/mt.cmj $stdlib
442
442
build test/module_splice_test.cmi test/module_splice_test.cmj : cc test/module_splice_test.ml | test/mt.cmj $stdlib
443
+ build test/more_poly_variant_test.cmi test/more_poly_variant_test.cmj : cc test/more_poly_variant_test.ml | $stdlib
443
444
build test/more_uncurry.cmi test/more_uncurry.cmj : cc test/more_uncurry.ml | $stdlib
444
445
build test/mpr_6033_test.cmi test/mpr_6033_test.cmj : cc test/mpr_6033_test.ml | test/mt.cmj $stdlib
445
446
build test/mt.cmj : cc_cmi test/mt.ml | test/mt.cmi $stdlib
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+
4
+ function map ( f , param ) {
5
+ if ( typeof param === "number" ) {
6
+ return /* Nil */ 3902385 ;
7
+ }
8
+ var match = param . VAL ;
9
+ return {
10
+ HASH : /* Cons */ 748545553 ,
11
+ VAL : [
12
+ f ( match [ 0 ] ) ,
13
+ map ( f , match [ 1 ] )
14
+ ]
15
+ } ;
16
+ }
17
+
18
+ function split_cases ( x ) {
19
+ if ( typeof x === "number" || x . HASH < 925929103 ) {
20
+ return {
21
+ HASH : /* A */ 65 ,
22
+ VAL : x
23
+ } ;
24
+ } else {
25
+ return {
26
+ HASH : /* B */ 66 ,
27
+ VAL : x
28
+ } ;
29
+ }
30
+ }
31
+
32
+ function f ( param ) {
33
+ if ( typeof param === "number" ) {
34
+ return "Tag3" ;
35
+ } else {
36
+ return "myvariant" ;
37
+ }
38
+ }
39
+
40
+ function g1 ( param ) {
41
+ if ( param . HASH >= 936370360 ) {
42
+ return "Tag2" ;
43
+ } else {
44
+ return "Tag1" ;
45
+ }
46
+ }
47
+
48
+ function g ( x ) {
49
+ if ( typeof x === "number" ) {
50
+ return "Tag3" ;
51
+ } else {
52
+ return g1 ( x ) ;
53
+ }
54
+ }
55
+
56
+ function f1 ( param ) {
57
+ if ( param >= 14610 ) {
58
+ return "A" ;
59
+ } else {
60
+ return "other" ;
61
+ }
62
+ }
63
+
64
+ function f2 ( x ) {
65
+ if ( typeof x === "number" ) {
66
+ if ( x >= 616641298 ) {
67
+ if ( x >= 936370362 ) {
68
+ console . log ( x ) ;
69
+ return 2 ;
70
+ } else {
71
+ return 3 ;
72
+ }
73
+ } else if ( x >= 104 ) {
74
+ return 2 ;
75
+ } else {
76
+ return 333 ;
77
+ }
78
+ } else {
79
+ console . log ( x ) ;
80
+ return 2 ;
81
+ }
82
+ }
83
+
84
+ exports . map = map ;
85
+ exports . split_cases = split_cases ;
86
+ exports . f = f ;
87
+ exports . g1 = g1 ;
88
+ exports . g = g ;
89
+ exports . f1 = f1 ;
90
+ exports . f2 = f2 ;
91
+ /* No side effect */
Original file line number Diff line number Diff line change
1
+ type 'a vlist = [`Nil | `Cons of 'a * 'a vlist ];;
2
+
3
+ let rec map f : 'a vlist -> 'b vlist = function
4
+ | `Nil -> `Nil
5
+ | `Cons (a , l ) -> `Cons (f a [@ bs], map f l)
6
+ ;;
7
+
8
+
9
+ let split_cases = function
10
+ | `Nil | `Cons _ as x -> `A x
11
+ | `Snoc _ as x -> `B x
12
+ ;;
13
+
14
+
15
+ type myvariant = [`Tag1 of int | `Tag2 of bool ]
16
+
17
+
18
+ let f = function
19
+ | #myvariant -> " myvariant"
20
+ | `Tag3 -> " Tag3" ;;
21
+
22
+ let g1 = function `Tag1 _ -> " Tag1" | `Tag2 _ -> " Tag2" ;;
23
+
24
+
25
+ let g = function
26
+ | #myvariant as x -> g1 x
27
+ | `Tag3 -> " Tag3" ;;
28
+
29
+ type abc = [`A | `B | `C ] ;;
30
+
31
+ let f1 = function
32
+ | `As -> " A"
33
+ | #abc -> " other" ;;
34
+
35
+ type myvariant2 = [`Tag3 of int | `Tag4 | myvariant ]
36
+ type x = [`a | `b | `c ]
37
+ let f2 x =
38
+ match x with
39
+ | #myvariant2 as x -> Js. log x ; 2
40
+ | `hello -> 3
41
+ | `h -> 2
42
+ | #x -> 333
You can’t perform that action at this time.
0 commit comments