text
stringlengths
0
601k
type ' a foo = { x : ' a ; y : int }
let r = { { x = 0 ; y = 0 } with x = 0 }
let r ' : string foo = r
let _ = foo ( ) ; ;
type ' a t = [ ` A of ' a t t ] as ' a ; ;
type ' a t = [ ` A of ' a t t ] ; ;
type ' a t = [ ` A of ' a t t ] constraint ' a = ' a t ; ;
type ' a t = [ ` A of ' a t ] constraint ' a = ' a t ; ;
type ' a t = [ ` A of ' a ] as ' a ; ;
type ' a v = [ ` A of u v ] constraint ' a = t and t = u and u = t ; ;
type ' a t = ' a ; ;
let f ( x : ' a t as ' a ) = ( ) ; ;
let f ( x : ' a t ) ( y : ' a ) = x = y ; ;
module type PR6505 = sig type ' o is_an_object = < . . > as ' o and ' o abs constraint ' o = ' o is_an_object val abs : ' o is_an_object -> ' o abs val unabs : ' o abs -> ' o
let f ~ x = x + 1 ; ;
let foo ( f : unit -> unit ) = ( ) ; ;
let g ? x ( ) = ( ) ; ;
type ' a t = ' a ; ;
let f ( g : ' a list -> ' a t -> ' a ) s = g s s ; ;
let f ( g : ' a * ' b -> ' a t -> ' a ) s = g s s ; ;
type ab = [ ` A | ` B ] ; ;
let f ( x : [ ` A ] ) = match x with # ab -> 1 ; ;
let f x = ignore ( match x with # ab -> 1 ) ; ignore ( x : [ ` A ] ) ; ;
let f x = ignore ( match x with ` A ` | B -> 1 ) ; ignore ( x : [ ` A ] ) ; ;
let f ( x : [ < ` A | ` B ] ) = match x with ` A | ` B | ` C -> 0 ; ;
let f ( x : [ ` A | ` B ] ) = match x with ` A | ` B | ` C -> 0 ; ;
let revapply x f = f x ; ;
let f x ( g : [ < ` Foo ] ) = let y = ` Bar x , g in revapply y ( fun ( ( ` Bar i ) , _ ) -> i ) ; ;
let rec x = [ | x ] ; | 1 . ; ;
let rec x = let u = [ | y ] | in 10 . and y = 1 . ; ;
let f : < . . > t -> unit = fun _ -> ( ) ; ;
let g : [ < ` b ] t -> unit = fun _ -> ( ) ; ;
let h : [ > ` b ] t -> unit = fun _ -> ( ) ; ;
let _ = fun ( x : a t ) -> f x ; ;
let _ = fun ( x : a t ) -> g x ; ;
let _ = fun ( x : a t ) -> h x ; ;
type t = [ ' A_name | ` Hi ] ; ;
let f ( x ' : id_arg ) = x ; ;
let f ( x ' : Id_arg ) = x ; ;
type t = { x : int ; y : int } ; ; { x = 3 ; z = 2 } ; ;
type u = private { mutable u : int } ; ; { u = 3 } ; ;
module M = struct type t = { x : int ; y : int } end ; ;
let f { M . x ; y } = x + y ; ;
let r = { M . x = 1 ; y = 2 } ; ;
let z = f r ; ;
type foo = { mutable y : int } ; ;
let f ( r : int ) = r . y <- 3 ; ;
type foo = { y : int ; z : int } ; ;
type bar = { x : int } ; ;
let f ( r : bar ) = ( { r with z = 3 } : foo )
type foo = { x : int } ; ;
let r : foo = { ZZZ . x = 2 } ; ;
let f ( x : Complex . t ) = x . Complex . z ; ;
module rec X : sig type t = int * bool type t = A | B let f = function A | B -> 0 end ; ;
type _ prod = Prod : ( ' a * ' y ) prod ; ;
let f : type t . t prod -> _ = function Prod -> let module M = struct type d = d * d end in ( ) ; ;
let ( a : M . a ) = 2
let ( b : M . b ) = 2
let _ = A . a = B . b
module Std = struct module Hash = Hashtbl end ; ;
module Hash1 : module type of Hash = Hash ; ;
module Hash2 : sig include ( module type of Hash ) end = Hash ; ;
let f1 ( x : ( _ , _ ) Hash1 . t ) = ( x : ( _ , _ ) Hashtbl . t ) ; ;
let f2 ( x : ( _ , _ ) Hash2 . t ) = ( x : ( _ , _ ) Hashtbl . t ) ; ;
module Std2 = struct module M = struct type t end end ; ;
module M ' : module type of Std ' . M = Std2 . M ; ;
let f3 ( x : M ' . t ) = ( x : Std2 . M . t ) ; ;
module type INCLUDING = sig include module type of List include module type of ListLabels end
module Including_typed : INCLUDING = struct include List include ListLabels end
module X = struct module type SIG = sig type t = int val x : t end module F ( Y : SIG ) : SIG = struct type t = Y . t let x = Y . x end end ; ;
module DUMMY = struct type t = int let x = 2 end ; ;
let x = ( 3 : X . F ( DUMMY ) . t ) ; ;
module X2 = struct module type SIG = sig type t = int val x : t end module F ( Y : SIG ) ( Z : SIG ) = struct type t = Y . t let x = Y . x type t ' = Z . t let x ' = Z . x end end ; ;
let x = ( 3 : X2 . F ( DUMMY ) ( DUMMY ) . t ) ; ;
let x = ( 3 : X2 . F ( DUMMY ) ( DUMMY ) . t ' ) ; ;
module F ( M : sig type ' a t type ' a u = string val f : unit -> _ u t end ) = struct let t = M . f ( ) end
type ' t a = [ ` A ]
type ' t wrap = ' t constraint ' t = [ > ' t wrap a ]
type t = t a wrap
module T = struct let foo : ' t wrap -> ' t wrap -> unit = fun _ _ -> ( ) let bar : ( ' a a wrap as ' a ) = ` A end
module Good : sig val bar : t val foo : t -> t -> unit
module Bad : sig val foo : t -> t -> unit val bar : t
module M : sig module type T module F ( X : T ) : sig end module type T = sig end module F ( X : T ) = struct end end
module type T = M . T
module F : functor ( X : T ) -> sig end = M . F
module type S = sig type t = { a : int ; b : int ; } end ; ;
let f ( module M : S with type t = int ) = { M . a = 0 } ; ;
let flag = ref false
module F ( S : sig module type T end ) ( A : S . T ) ( B : S . T ) = struct module X = ( val if ! flag then ( module A ) else ( module B ) : S . T ) end
module type S = sig type t val x : t end
module Float = struct type t = float let x = 0 . 0 end
module Int = struct type t = int let x = 0 end
module M = F ( struct module type T = S end )
let ( ) = flag := false
let ( ) = flag := true
let _ = [ | M2 . X . x ; M1 . X . x ] |
module type PR6513 = sig
module type S = sig type u end
module type T = sig type ' a wrap type uri end
module Make : functor ( Html5 : T with type ' a wrap = ' a ) -> S with type u = < foo : Html5 . uri > end