Skip to content

Commit e90e6c4

Browse files
authored
flambda-backend: Produce Invalid upon mode mismatch in partial application (#2548)
1 parent d34a037 commit e90e6c4

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
(* TEST
2+
{
3+
stack-allocation;
4+
ocamlopt_flags = "-Oclassic";
5+
}{
6+
stack-allocation;
7+
ocamlopt_flags = "-O3";
8+
}
9+
*)
10+
11+
type (_,_) eq = Refl : ('a, 'a) eq
12+
13+
let apply (type a) (equ : (a, unit -> unit) eq option) (f : a) =
14+
match equ with
15+
| None -> ()
16+
| Some Refl -> f ()
17+
18+
let fn (local_ x) (local_ y) = ()
19+
20+
let bad p = apply p fn
21+
22+
(* More minimal example: *)
23+
24+
let cast (type a b) (Refl : (a, b) eq) (f : a) : b = f
25+
26+
let fn (local_ x) (local_ y) = ()
27+
let bad2 p = cast p fn ()

0 commit comments

Comments
 (0)