Skip to content

Commit 68e32fe

Browse files
committed
Updated tests
1 parent 5fb8573 commit 68e32fe

11 files changed

+2147
-2277
lines changed

compiler/tests-compiler/double-translation/effects_continuations.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ let%expect_test "test-compiler/lib-effects/test1.ml" =
103103
function exceptions$0(s){
104104
try{var _C_ = caml_int_of_string(s), n = _C_;}
105105
catch(exn$0){
106-
var exn = caml_wrap_exception(exn$0);
107-
if(exn[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(exn, 0);
106+
var exn = caml_wrap_exception(exn$0), tag = exn[1];
107+
if(tag !== Stdlib[7]) throw caml_maybe_attach_backtrace(exn, 0);
108108
var n = 0;
109109
}
110110
try{
@@ -133,8 +133,8 @@ let%expect_test "test-compiler/lib-effects/test1.ml" =
133133
function exceptions$1(s, cont){
134134
try{var _y_ = caml_int_of_string(s), n = _y_;}
135135
catch(exn){
136-
var exn$2 = caml_wrap_exception(exn);
137-
if(exn$2[1] !== Stdlib[7]){
136+
var exn$2 = caml_wrap_exception(exn), tag = exn$2[1];
137+
if(tag !== Stdlib[7]){
138138
var
139139
raise$1 = caml_pop_trap(),
140140
exn$0 = caml_maybe_attach_backtrace(exn$2, 0);

compiler/tests-compiler/double-translation/effects_exceptions.ml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ let%expect_test "test-compiler/lib-effects/test1.ml" =
5858
function exceptions$0(s){
5959
try{var _p_ = caml_int_of_string(s), n = _p_;}
6060
catch(exn$0){
61-
var exn = caml_wrap_exception(exn$0);
62-
if(exn[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(exn, 0);
61+
var exn = caml_wrap_exception(exn$0), tag = exn[1];
62+
if(tag !== Stdlib[7]) throw caml_maybe_attach_backtrace(exn, 0);
6363
var n = 0;
6464
}
6565
try{
@@ -88,8 +88,8 @@ let%expect_test "test-compiler/lib-effects/test1.ml" =
8888
function exceptions$1(s, cont){
8989
try{var _l_ = caml_int_of_string(s), n = _l_;}
9090
catch(exn){
91-
var exn$2 = caml_wrap_exception(exn);
92-
if(exn$2[1] !== Stdlib[7]){
91+
var exn$2 = caml_wrap_exception(exn), tag = exn$2[1];
92+
if(tag !== Stdlib[7]){
9393
var
9494
raise$1 = caml_pop_trap(),
9595
exn$0 = caml_maybe_attach_backtrace(exn$2, 0);
@@ -136,8 +136,8 @@ let%expect_test "test-compiler/lib-effects/test1.ml" =
136136
catch(exn$0){
137137
var l$0 = l;
138138
for(;;){
139-
var match = caml_call1(g, l$0);
140-
if(72330306 > match[1]){
139+
var match = caml_call1(g, l$0), variant = match[1];
140+
if(72330306 > variant){
141141
var exn = match[2];
142142
throw caml_maybe_attach_backtrace(exn, 1);
143143
}
@@ -155,7 +155,8 @@ let%expect_test "test-compiler/lib-effects/test1.ml" =
155155
(g,
156156
l,
157157
function(match){
158-
if(72330306 <= match[1]){
158+
var variant = match[1];
159+
if(72330306 <= variant){
159160
var l = match[2];
160161
return caml_exact_trampoline_call1(_h_, l);
161162
}

compiler/tests-compiler/effects_continuations.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ let%expect_test "test-compiler/lib-effects/test1.ml" =
104104
function exceptions(s, cont){
105105
try{var _y_ = runtime.caml_int_of_string(s), n = _y_;}
106106
catch(exn$0){
107-
var exn = caml_wrap_exception(exn$0);
108-
if(exn[1] !== Stdlib[7]){
107+
var exn = caml_wrap_exception(exn$0), tag = exn[1];
108+
if(tag !== Stdlib[7]){
109109
var raise$1 = caml_pop_trap(), exn$2 = caml_maybe_attach_backtrace(exn, 0);
110110
return raise$1(exn$2);
111111
}

compiler/tests-compiler/effects_exceptions.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ let%expect_test "test-compiler/lib-effects/test1.ml" =
5858
function exceptions(s, cont){
5959
try{var _j_ = runtime.caml_int_of_string(s), n = _j_;}
6060
catch(exn$0){
61-
var exn = caml_wrap_exception(exn$0);
62-
if(exn[1] !== Stdlib[7]){
61+
var exn = caml_wrap_exception(exn$0), tag = exn[1];
62+
if(tag !== Stdlib[7]){
6363
var raise$1 = caml_pop_trap(), exn$2 = caml_maybe_attach_backtrace(exn, 0);
6464
return raise$1(exn$2);
6565
}
@@ -107,7 +107,8 @@ let%expect_test "test-compiler/lib-effects/test1.ml" =
107107
(g,
108108
l,
109109
function(match){
110-
if(72330306 <= match[1]){
110+
var variant = match[1];
111+
if(72330306 <= variant){
111112
var l = match[2];
112113
return caml_exact_trampoline_call1(_g_, l);
113114
}

compiler/tests-compiler/es6.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ let rec odd n' = function
6161
for(;;){
6262
if(0 === c) return [0, d, 0];
6363
if(1 === c) return [0, d, 1];
64-
[c, d] = [(d - 1 | 0) - 1 | 0, (c - 1 | 0) - 1 | 0];
64+
[d, c] = [(c - 1 | 0) - 1 | 0, (d - 1 | 0) - 1 | 0];
6565
}}],
6666
"Test");
6767
return;})

compiler/tests-compiler/gh1007.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,8 @@ let () = M.run ()
633633
let odd$0 = odd, even$0 = even;
634634
var param$0 = even(i);
635635
for(;;){
636-
if(759635106 <= param$0[1]) break;
636+
var variant = param$0[1];
637+
if(759635106 <= variant) break;
637638
var f = param$0[2];
638639
param$0 = f(0);
639640
}

compiler/tests-compiler/gh1868.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ let wrap f =
4343
catch(exn$1){
4444
var exn = caml_wrap_exception(exn$1);
4545
for(;;){
46-
if(exn[1] !== Nested) throw caml_maybe_attach_backtrace(exn, 1);
46+
var tag = exn[1];
47+
if(tag !== Nested) throw caml_maybe_attach_backtrace(exn, 1);
4748
var exn$0 = exn[2];
4849
exn = exn$0;
4950
}
@@ -52,7 +53,8 @@ let wrap f =
5253
//end
5354
function wrap$1(f, cont){
5455
function _b_(exn$1){
55-
if(exn$1[1] === Nested){
56+
var tag = exn$1[1];
57+
if(tag === Nested){
5658
var exn$0 = exn$1[2];
5759
return caml_exact_trampoline_call1(_b_, exn$0);
5860
}

compiler/tests-compiler/inlining.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ let%expect_test "inline small function exposing more tc" =
5050
[%expect
5151
{|
5252
function f(g, x){
53-
if(106380200 <= x[1]) return x;
54-
var v$0 = x[2], x$0 = caml_call1(g, v$0);
55-
if(106380200 <= x$0[1]) return x$0;
53+
var variant$0 = x[1];
54+
if(106380200 <= variant$0) return x;
55+
var v$0 = x[2], x$0 = caml_call1(g, v$0), variant = x$0[1];
56+
if(106380200 <= variant) return x$0;
5657
var v = x$0[2];
5758
return v;
5859
}

compiler/tests-compiler/loops.ml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,15 @@ let rec fun_with_loop acc = function
8585
return caml_call1
8686
(list_rev, caml_call1(list_rev, caml_call1(list_rev, acc)));
8787
var x = param[1];
88-
if(1 === x && ! param[2]) break;
88+
if(1 === x && ! param[2]){
89+
var a$0 = [0, acc], i$0 = 0;
90+
for(;;){
91+
a$0[1] = [0, 1, a$0[1]];
92+
var _b_ = i$0 + 1 | 0;
93+
if(10 === i$0) return a$0[1];
94+
i$0 = _b_;
95+
}
96+
}
8997
var xs = param[2], a = [0, acc], i = 0;
9098
for(;;){
9199
a[1] = [0, 1, a[1]];
@@ -97,13 +105,6 @@ let rec fun_with_loop acc = function
97105
acc = acc$0;
98106
param = xs;
99107
}
100-
var a$0 = [0, acc], i$0 = 0;
101-
for(;;){
102-
a$0[1] = [0, 1, a$0[1]];
103-
var _b_ = i$0 + 1 | 0;
104-
if(10 === i$0) return a$0[1];
105-
i$0 = _b_;
106-
}
107108
}
108109
//end
109110
|}]
@@ -130,14 +131,12 @@ let for_for_while () =
130131
var k = 1;
131132
for(;;){
132133
var j = 1;
133-
for(;;)
134-
if(10 <= runtime.caml_mul(k, j)){
135-
var _b_ = j + 1 | 0;
136-
if(10 === j) break;
137-
j = _b_;
138-
}
139-
else
140-
id[1]++;
134+
for(;;){
135+
for(;;){if(10 <= runtime.caml_mul(k, j)) break; id[1]++;}
136+
var _b_ = j + 1 | 0;
137+
if(10 === j) break;
138+
j = _b_;
139+
}
141140
var _a_ = k + 1 | 0;
142141
if(10 === k) return 0;
143142
k = _a_;
@@ -169,17 +168,17 @@ let for_for_while () =
169168
var k = 1;
170169
for(;;){
171170
var j = 1;
172-
for(;;)
173-
if(10 <= caml_div(k, j)){
174-
var _b_ = j + 1 | 0;
175-
if(10 === j) break;
176-
j = _b_;
177-
}
178-
else{
171+
for(;;){
172+
for(;;){
173+
if(10 <= caml_div(k, j)) break;
179174
try{caml_div(k, j);}
180175
catch(exn){throw caml_maybe_attach_backtrace(Stdlib[8], 1);}
181176
id[1]++;
182177
}
178+
var _b_ = j + 1 | 0;
179+
if(10 === j) break;
180+
j = _b_;
181+
}
183182
var _a_ = k + 1 | 0;
184183
if(10 === k) return 0;
185184
k = _a_;

compiler/tests-compiler/match_with_exn.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ let fun2 () =
7777
{
7878
try{var i$1 = caml_call1(Stdlib_Random[5], 2);}
7979
catch(exn$0){
80-
var exn = caml_wrap_exception(exn$0);
81-
if(exn[1] !== A) throw caml_maybe_attach_backtrace(exn, 0);
80+
var exn = caml_wrap_exception(exn$0), tag = exn[1];
81+
if(tag !== A) throw caml_maybe_attach_backtrace(exn, 0);
8282
var i = exn[2];
8383
if(2 !== i) return i + 2 | 0;
8484
var i$0 = i;

0 commit comments

Comments
 (0)