Skip to content

failwith now accepts arbitrary type as input

Rémi requested to merge 193-failwith-should-support-arbitrary-types into dev


Added a warning when using failwith (instead of Test.failwith) in testing logic, a nice side-effect is that we now have warnings when originating contract (Test.originate)

Changelog details:

The failwith primitive now accepts arbitrary type as input.

breaking changes

failwith is now typed as forall a b . a -> b, instead of applying an ad-hoc rule giving unit as a default return type. In general, this will require more type annotations, as in:

let toplevel_failwith = failwith "I am failing" (* will not type anymore *)
let toplevel_failwith : unit = failwith "I am failing"

let f = fun (_ : unit) -> failwith (x + x + String.length y) (* will not type anymore *)
let f = fun (_ : unit) : unit -> failwith (x + x + String.length y)

Closes #193 (closed)

Edited by Rémi

Merge request reports