| 1 |
module Position_for_polymorphic_variant_errors = struct |
| 2 |
type t1 = [ `A ] [@@deriving of_sexp] |
| 3 |
type t2 = [ `B ] [@@deriving of_sexp] |
| 4 |
type t3 = A of [ t1 | t2 ] [@@deriving of_sexp] |
| 5 |
|
| 6 |
let (_ : t3) = t3_of_sexp (List [ Atom "A"; Atom "C" ]) |
| 7 |
end |
| 8 |
|
| 9 |
[%%expect |
| 10 |
{| |
| 11 |
Exception: |
| 12 |
(Of_sexp_error |
| 13 |
"examples.mlt.Position_for_polymorphic_variant_errors.t3_of_sexp: no matching variant found" |
| 14 |
(invalid_sexp C)) |
| 15 |
|}] |
| 16 |
|
| 17 |
let _ = [%sexp_of: 'a] |
| 18 |
|
| 19 |
[%%expect |
| 20 |
{| |
| 21 |
Line _, characters _-_: |
| 22 |
Error: ppx_sexp_conv: unbound type variable 'a |
| 23 |
|}] |
| 24 |
|
| 25 |
let _ = [%of_sexp: 'a] |
| 26 |
|
| 27 |
[%%expect |
| 28 |
{| |
| 29 |
Line _, characters _-_: |
| 30 |
Error: ppx_sexp_conv: unbound type variable 'a |
| 31 |
|}] |
| 32 |
|
| 33 |
let _ = [%sexp (() : 'a)] |
| 34 |
|
| 35 |
[%%expect |
| 36 |
{| |
| 37 |
Line _, characters _-_: |
| 38 |
Error: ppx_sexp_conv: unbound type variable 'a |
| 39 |
|}] |
| 40 |
|
| 41 |
type 'a t = |
| 42 |
| None |
| 43 |
| Something_else of { value : 'a } |
| 44 |
[@@deriving sexp] |
| 45 |
|
| 46 |
[%%expect {| |}] |
| 47 |
|
| 48 |
module Record_with_defaults = struct |
| 49 |
open Sexplib0.Sexp_conv |
| 50 |
|
| 51 |
let a_field = "a_field" |
| 52 |
let b_field = "b_field" |
| 53 |
|
| 54 |
type record_with_defaults = |
| 55 |
{ a : string [@default a_field] |
| 56 |
; b : string [@default b_field] |
| 57 |
} |
| 58 |
[@@deriving of_sexp] |
| 59 |
end |
| 60 |
|
| 61 |
[%%expect {| |}] |
| 62 |
|
| 63 |
module Polymorphic_recursion = struct |
| 64 |
type 'a t = T of 'a t t [@@deriving sexp_grammar] |
| 65 |
end |
| 66 |
|
| 67 |
[%%expect {| |}] |