Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
Signed-off-by: Charlie Gunn <[email protected]>
  • Loading branch information
Charlie Gunn committed Aug 2, 2024
1 parent 19ddbf5 commit 55be4b1
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 23 deletions.
35 changes: 25 additions & 10 deletions test/passing/tests/function_constraint.ml
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
let f = fun (type a) -> (() : unit)
(* RHS annotated with a type *)
let f (type a) = (() : unit)

let f = fun (type a : immediate) -> (() : unit)
let f (type a : immediate) = (() : unit)

let f = fun (type a) x -> (() : unit)
let f x y = (() : unit)

let f = fun x y -> (() : unit)
(* RHS annotated with a type and mode *)
let f (type a) = (() : unit @@ local)

let f = fun (type a : value) x -> (() : unit)
let f (type a : value) = (() : unit @@ local)

let f = fun (type a) -> (() : unit @@ local)
let f x y = (() : unit @@ local)

let f = fun (type a : immediate) -> (() : unit @@ local)
(* LHS and RHS annotated with the same type *)
let f (type a) : unit = (() : unit)

let f = fun (type a) x -> (() : unit @@ local)
let f (type a : value) : unit = (() : unit)

let f = fun x y -> (() : unit @@ local)
let f x y : unit = (() : unit)

let f = fun (type a : value) x -> (() : unit @@ local)
(* LHS and RHS annotated with different types *)
let f (type a) : unit = (() : int)

let f (type a : value) : unit = (() : int)

let f x y : unit = (() : int)

(* LHS annotated with a mode, RHS annotated with a type *)
let (f @ local) (type a) = (() : unit)

let (f @ local) (type a : value) = (() : unit)

let (f @ local) x y = (() : unit)
24 changes: 19 additions & 5 deletions test/passing/tests/function_constraint.ml.js-ref
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
(* RHS annotated with a type *)
let f (type a) : unit = ()
let f (type a : immediate) : unit = ()
let f (type a) x : unit = ()
let f x y : unit = ()
let f (type a : value) x : unit = ()

(* RHS annotated with a type and mode *)
let f (type a) = (() : unit @@ local)
let f (type a : immediate) = (() : unit @@ local)
let f (type a) x = (() : unit @@ local)
let f (type a : value) = (() : unit @@ local)
let f x y = (() : unit @@ local)
let f (type a : value) x = (() : unit @@ local)

(* LHS and RHS annotated with the same type *)
let f (type a) : unit = (() : unit)
let f (type a : value) : unit = (() : unit)
let f x y : unit = (() : unit)

(* LHS and RHS annotated with different types *)
let f (type a) : unit = (() : int)
let f (type a : value) : unit = (() : int)
let f x y : unit = (() : int)

(* LHS annotated with a mode, RHS annotated with a type *)
let (f @ local) (type a) : unit = ()
let (f @ local) (type a : value) : unit = ()
let (f @ local) x y : unit = ()
31 changes: 23 additions & 8 deletions test/passing/tests/function_constraint.ml.ref
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
(* RHS annotated with a type *)
let f (type a) : unit = ()

let f (type a : immediate) : unit = ()

let f (type a) x : unit = ()

let f x y : unit = ()

let f (type a : value) x : unit = ()

(* RHS annotated with a type and mode *)
let f (type a) = (() : unit @@ local)

let f (type a : immediate) = (() : unit @@ local)

let f (type a) x = (() : unit @@ local)
let f (type a : value) = (() : unit @@ local)

let f x y = (() : unit @@ local)

let f (type a : value) x = (() : unit @@ local)
(* LHS and RHS annotated with the same type *)
let f (type a) : unit = (() : unit)

let f (type a : value) : unit = (() : unit)

let f x y : unit = (() : unit)

(* LHS and RHS annotated with different types *)
let f (type a) : unit = (() : int)

let f (type a : value) : unit = (() : int)

let f x y : unit = (() : int)

(* LHS annotated with a mode, RHS annotated with a type *)
let (f @ local) (type a) : unit = ()

let (f @ local) (type a : value) : unit = ()

let (f @ local) x y : unit = ()

0 comments on commit 55be4b1

Please sign in to comment.