Skip to content

Commit

Permalink
Update example_limitations with an arity warning example
Browse files Browse the repository at this point in the history
  • Loading branch information
jmid committed Dec 10, 2024
1 parent 54cfdb5 commit b33e5a6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions plugins/qcheck-stm/doc/example_limitations.mli
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ val of_list : 'a list -> 'a t
val g : 'a t -> 'a * 'a * 'a * 'a * 'a * 'a * 'a * 'a * 'a * 'a -> bool
(*@ b = g t x *)

val for_all : ('a -> bool) -> 'a t -> bool
(*@ b = for_all p t *)
val large_second_order_arity : ('a -> 'a -> 'a -> 'a -> 'a -> bool) -> 'a t -> bool
(*@ b = large_second_order_arity p t *)

(* $MDX part-end *)
16 changes: 9 additions & 7 deletions plugins/qcheck-stm/doc/index.mld
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ val for_all : 'a t -> bool

Finally, note that this tool is still fairly new and comes with limitations
that should be lifted in the future. Fow now, we only support tuples with less
than 10 elements and we only support first-order functions.
than 10 elements and we only support first-order functions and second-order
functions up to arity four.

If we add the following declarations to our example file,

Expand All @@ -403,8 +404,8 @@ val of_list : 'a list -> 'a t
val g : 'a t -> 'a * 'a * 'a * 'a * 'a * 'a * 'a * 'a * 'a * 'a -> bool
(*@ b = g t x *)

val for_all : ('a -> bool) -> 'a t -> bool
(*@ b = for_all p t *)
val large_second_order_arity : ('a -> 'a -> 'a -> 'a -> 'a -> bool) -> 'a t -> bool
(*@ b = large_second_order_arity p t *)
]}

Ortac/QCheck-STM will generate the following warnings:
Expand All @@ -423,10 +424,11 @@ File "example_limitations.mli", line 20, characters 16-63:
20 | val g : 'a t -> 'a * 'a * 'a * 'a * 'a * 'a * 'a * 'a * 'a * 'a -> bool
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning: Skipping g: Can only test tuples with arity < 10.
File "example_limitations.mli", line 23, characters 15-25:
23 | val for_all : ('a -> bool) -> 'a t -> bool
^^^^^^^^^^
Warning: Skipping for_all: functions are not supported yet as arguments.
File "example_limitations.mli", line 23, characters 32-66:
23 | val large_second_order_arity : ('a -> 'a -> 'a -> 'a -> 'a -> bool) -> 'a t -> bool
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning: Skipping large_second_order_arity: Can only test function arguments
with arity < 5.
]}

{2:returning-sut Functions returning a SUT}
Expand Down

0 comments on commit b33e5a6

Please sign in to comment.