Skip to content

Commit 10ac8c0

Browse files
committed
move some tests from ounit to super_errors
1 parent 9706da8 commit 10ac8c0

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/type2.res:6:11-13
4+
5+
4 │ let () = {
6+
5 │ push(a, 3)->ignore
7+
6 │ push(a, "3")->ignore
8+
7 │ }
9+
8 │
10+
11+
This has type: string
12+
Somewhere wanted: int
13+
14+
You can convert string to int with Belt.Int.fromString.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/type3.res:1:5
4+
5+
1 │ let u = []
6+
2 │
7+
8+
This expression's type contains type variables that cannot be generalized:
9+
array<'_weak1>
10+
11+
This happens when the type system senses there's a mutation/side-effect,
12+
in combination with a polymorphic value.
13+
Using or annotating that value usually solves it.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@send external push: (array<'a>, 'a) => unit = "push"
2+
3+
let a = []
4+
let () = {
5+
push(a, 3)->ignore
6+
push(a, "3")->ignore
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
let u = []

jscomp/ounit_tests/ounit_cmd_tests.ml

+4-4
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,14 @@ let rec y = A y;;
276276
OUnit.assert_bool __LOC__
277277
(Ext_string.contain_substring should_err.stderr "contravariant")
278278
end;
279-
__LOC__ >:: begin fun _ ->
279+
(* __LOC__ >:: begin fun _ ->
280280
let should_err = bsc_check_eval {|
281281
let u = [||]
282282
|} in
283283
OUnit.assert_bool __LOC__
284284
(Ext_string.contain_substring should_err.stderr "cannot be generalized")
285-
end;
286-
__LOC__ >:: begin fun _ ->
285+
end; *)
286+
(* __LOC__ >:: begin fun _ ->
287287
let should_err = bsc_check_eval {|
288288
external push : 'a array -> 'a -> unit = "push" [@@send]
289289
let a = [||]
@@ -293,7 +293,7 @@ let () =
293293
|} in
294294
OUnit.assert_bool __LOC__
295295
(Ext_string.contain_substring should_err.stderr "string")
296-
end
296+
end *)
297297
(* __LOC__ >:: begin fun _ -> *)
298298
(* let should_infer = perform_bsc [| "-i"; "-bs-eval"|] {| *)
299299
(* let f = fun [@bs] x -> let (a,b) = x in a + b *)

0 commit comments

Comments
 (0)