ocaml-gospel / gospel

A tool-agnostic formal specification language for OCaml.
https://ocaml-gospel.github.io/gospel
MIT License
128 stars 16 forks source link

Gospel does not parse `fun` type annotations as OCaml #305

Closed shym closed 1 year ago

shym commented 1 year ago

The following code is accepted by the OCaml type checker:

  fun true : int -> 12

(besides the obviously non-exhaustive pattern true), meaning that the int is the return type but the Gospel typechecker accepts the following:

val f : int list -> int
(*@ y = f xs
    ensures List.for_all (fun x : int -> true) xs *)

where int is interpreted as the type for the argument x.

shym commented 1 year ago

309 will change that situation:

val f : int list -> int
(*@ y = f xs
    ensures List.for_all (fun x : int -> true) xs *)

will now report a syntax error at : int as the type annotation is not handled by the parser.

n-osborne commented 1 year ago

Fixed by #309