File tree Expand file tree Collapse file tree 5 files changed +108
-1
lines changed Expand file tree Collapse file tree 5 files changed +108
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ a_string_test.cmo : mt.cmo ../stdlib/list.cmi ext_string.cmo
26
26
a_string_test.cmx : mt.cmx ../stdlib/list.cmx ext_string.cmx
27
27
abstract_type.cmo : abstract_type.cmi
28
28
abstract_type.cmx : abstract_type.cmi
29
+ and_or_tailcall_test.cmo : mt.cmo
30
+ and_or_tailcall_test.cmx : mt.cmx
29
31
ari_regress_test.cmo : mt.cmo ari_regress_test.cmi
30
32
ari_regress_test.cmx : mt.cmx ari_regress_test.cmi
31
33
arith_lexer.cmo : ../stdlib/lexing.cmi arith_syntax.cmo arith_parser.cmo
@@ -390,6 +392,8 @@ a_string_test.cmo : mt.cmo ../stdlib/list.cmi ext_string.cmo
390
392
a_string_test.cmj : mt.cmj ../stdlib/list.cmj ext_string.cmj
391
393
abstract_type.cmo : abstract_type.cmi
392
394
abstract_type.cmj : abstract_type.cmi
395
+ and_or_tailcall_test.cmo : mt.cmo
396
+ and_or_tailcall_test.cmj : mt.cmj
393
397
ari_regress_test.cmo : mt.cmo ari_regress_test.cmi
394
398
ari_regress_test.cmj : mt.cmj ari_regress_test.cmi
395
399
arith_lexer.cmo : ../stdlib/lexing.cmi arith_syntax.cmo arith_parser.cmo
Original file line number Diff line number Diff line change
1
+ export var f : ( b : any , x : any , n : any ) => any ;
2
+ export var or_f : ( b : any , x : any , n : any ) => any ;
3
+ export var suites : any ;
4
+
Original file line number Diff line number Diff line change
1
+ // Generated CODE, PLEASE EDIT WITH CARE
2
+ 'use strict' ;
3
+
4
+ var Mt = require ( "./mt" ) ;
5
+
6
+ function f ( b , _ , _n ) {
7
+ while ( true ) {
8
+ var n = _n ;
9
+ if ( n > 100000 ) {
10
+ return /* false */ 0 ;
11
+ }
12
+ else if ( b ) {
13
+ _n = n + 1 ;
14
+ continue ;
15
+
16
+ }
17
+ else {
18
+ return /* false */ 0 ;
19
+ }
20
+ } ;
21
+ }
22
+
23
+ function or_f ( b , _ , _n ) {
24
+ while ( true ) {
25
+ var n = _n ;
26
+ if ( n > 100000 ) {
27
+ return /* false */ 0 ;
28
+ }
29
+ else if ( b ) {
30
+ return /* true */ 1 ;
31
+ }
32
+ else {
33
+ _n = n + 1 ;
34
+ continue ;
35
+
36
+ }
37
+ } ;
38
+ }
39
+
40
+ var suites_001 = [
41
+ /* tuple */ 0 ,
42
+ "and_tail" ,
43
+ function ( ) {
44
+ return [
45
+ /* Eq */ 0 ,
46
+ /* false */ 0 ,
47
+ f ( /* true */ 1 , 1 , 0 )
48
+ ] ;
49
+ }
50
+ ] ;
51
+
52
+ var suites_002 = [
53
+ /* :: */ 0 ,
54
+ [
55
+ /* tuple */ 0 ,
56
+ "or_tail" ,
57
+ function ( ) {
58
+ return [
59
+ /* Eq */ 0 ,
60
+ /* false */ 0 ,
61
+ or_f ( /* false */ 0 , 1 , 0 )
62
+ ] ;
63
+ }
64
+ ] ,
65
+ /* [] */ 0
66
+ ] ;
67
+
68
+ var suites = [
69
+ /* :: */ 0 ,
70
+ suites_001 ,
71
+ suites_002
72
+ ] ;
73
+
74
+ Mt . from_pair_suites ( "and_or_tailcall_test.ml" , suites ) ;
75
+
76
+ exports . f = f ;
77
+ exports . or_f = or_f ;
78
+ exports . suites = suites ;
79
+ /* Not a pure module */
Original file line number Diff line number Diff line change
1
+ let rec f b x n =
2
+ if n > 100000 then false
3
+ else b && f b x (n + 1 )
4
+
5
+
6
+ let rec or_f b x n =
7
+ if n > 100000 then false
8
+ else b || or_f b x (n + 1 )
9
+
10
+
11
+
12
+ let suites = Mt. [
13
+ (* becareful inlining will defeat the test purpose here *)
14
+ " and_tail" , (fun _ -> Eq (false , f true 1 0 ));
15
+ " or_tail" , (fun _ -> Eq (false , or_f false 1 0 ));
16
+ ]
17
+
18
+ ;; Mt. from_pair_suites __FILE__ suites
Original file line number Diff line number Diff line change @@ -159,4 +159,6 @@ regression_print
159
159
global_exception_regression_test
160
160
printf_test
161
161
format_regression
162
- loop_regression_test
162
+ loop_regression_test
163
+ and_or_tailcall_test
164
+
You can’t perform that action at this time.
0 commit comments