1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
module M : sig
class \#and : object
val mutable \#and : int
method \#and : int
end
end = struct
class \#and =
let \#and = 1 in
object
val mutable \#and = \#and
method \#and = 2
end
end
let obj = new M.\#and
module M : sig
type \#and = int
end = struct
type \#and = string
end
let x = (`\#let `\#and : [ `\#let of [ `\#and ] ])
let (`\#let \#rec) = x
let f g ~\#let ?\#and ?(\#for = \#and) () = g ~\#let ?\#and ()
type t = '\#let
type \#mutable = { mutable \#mutable : \#mutable }
let rec \#rec = { \#mutable = \#rec }
type \#and = ..
type \#and += Foo
(* Not allowed in parser: type t += \#and *)
let x = ( ++ )
let x = \#let
let f ~\#let ?\#and () = 1
module type A = sig
type ('\#let, 'a) \#virtual = '\#let * 'a as '\#mutable
val foo : '\#let 'a. 'a -> '\#let -> unit
type foo = { \#let : int }
end
module M = struct
let ((\#let, foo) as \#val) = (\#mutable, baz)
let _ = fun (type \#let foo) -> 1
let f g ~\#let ?\#and ?(\#for = \#and) () = g ~\#let ?\#and ()
class \#let =
object
inherit \#val \#let as \#mutable
end
end
type 'a \#for = 'a list
type 'a \#sig = 'a \#for
type \#true = bool
type _ t = \#in t
type '\#in t
class ['\#in] c = c
let f \#false = \#false
type t = { x : int \#let }
let x \#let = 42
let x = f ~\#let:42 ~\#and:43
let f ~\#let ~\#and : \#let * \#and = x;;
kind_abbrev_ \#let = \#and;;
type t = T : 'a list -> t
let g x =
let (T (type \#for) (_ : \#for list)) = x in
()
let ( lsl ) x y = x lsl y
let \#lsl x y = x lsl y
module type \#sig = sig end
module M = struct
let \#mod = 1
end
let _ = M.\#mod
module type \#sig = M
module type M = \#sig
module type M = M with module type \#sig = \#sig
module type M = M with module type \#sig := \#sig
let _ = \#sig.(())
(* Raw idents in module names are not allowed in parser: *)
(* let (module \#sig : S) = () *)
(* module \#sig (A : S) = M *)
(* module \#sig = M *)
(* module M (\#sig : S) = M *)
(* module M = M (functor (\#sig : S) -> struct end) *)
(* module type S = functor (\#sig : S) -> S' *)
(* module type M = M with module \#sig = \#sig *)
(* module type M = M with module \#sig := \#sig *)
let _ =
(* let module \#sig = \#sig in *)
(* let open \#sig in *)
()
let%\#let _ = ()
let _ = [%\#let ()]
let _ = () [@\#let]
let _ = () [@@\#let]
let f : type \#in. t = ()
let f : '\#in. t = ()
let \#mod : '\#mod. \#mod = \#mod
let mlet = M.\#let
let mtrue = M.\#true
let mmod = M.\#mod
type tmod = M.\#mod
type tlet = M.\#let
type ttrue = M.\#true
(* class \#mod = object end *)
let f : #M.\#mod -> _ = (new \#mod, new M.\#mod)
class type \#mod = object end
class type \#let = \#mod
module type \#mod = sig
type \#mod
module type \#mod
end
module type t = \#mod with type \#mod = M.\#mod and module type \#mod = M.\#mod
type \#mod = [ `A | `B ]
let g = function #\#mod | #M.\#mod -> ()
type \#mod = ..
type M.\#mod += A
type t = true of int
let x = true 0
|