1. camlspotter
  2. ocamlspot

Commits

camlspotter  committed c3d3348

fixed examples

  • Participants
  • Parent commits c8bb3b4
  • Branches default

Comments (0)

Files changed (17)

File tests/Makefile.targets

View file
 class.cmi \
 class2.cmi \
 exception.cmo \
+exception_alias.cmo \
+exception_module.cmo \
 external.cmo \
 external_include.cmo \
 fstclassmodule.cmo \

File tests/class.ml

View file
-class (* class c => *) c =  (* CR: pos can be improved *)
+class (* class c => *) c (* <= class c *) =  (* CR: pos can be improved *)
   let (* x => *) x (* <= x *) = 1 in
   let (* y => *) y (* <= y *) = x (* ? x *) in
   object
     val x = x (* ? x *)
     val y = y (* ? y *)
-    val (* vx => *) vx = 1 (* <= vx *) (* CR: pos can be improved *)
+    val (* vx => *) vx (* <= vx *) = 1 
     method m = vx (* ? vx *)
-end (* <= class c *)
+end 
 
 let v = new c (* ? class c *)
 ;;

File tests/class.mli

View file
-class (* c => *) 
-  c : object val vx : int val x : int val y : int method m : int end
-(* <= c *)
+class (* c => *) c (* <= c *) : object val vx : int val x : int val y : int method m : int end
+
 val v : c (* ? c *)

File tests/class2.mli

View file
 module M0 : sig
-  class (* M0.c => *) c : object end (* <= M0.c *)
+  class (* M0.c => *) c (* <= M0.c *): object end 
 end
 (* <= M0 *)
 
 module Test : sig
   val v : M0.c (* ? M0.c *)
-  class type (* ct => *) ct = M0.c (* <= ct *)
+  class type (* ct => *) ct (* <= ct *)= M0.c 
   class type ct' = M0.c (* ? M0.c *) 
   val z : ct (* ? ct *)
 end

File tests/exception_alias.ml

View file
+exception (* E => *) E (* <= E *)
+exception X = E (* ? E *) (* bug 090818 *)
+

File tests/exception_module.ml

View file
+module M = struct
+  exception (* EE => *) EE (* <= EE *)
+end
+
+let _ = raise M.EE (* ? EE *)

File tests/fstclassmodule2.ml

View file
-module type ASig = sig (* B.f => *) val f : int -> int (* <= B.f *) end
+module type ASig = sig val (* B.f => *) f (* <= B.f *) : int -> int end
 module A = struct let f x = x + 1 end
 let x = (module A : ASig)
 let y = 

File tests/included_value.ml

View file
+module (* M => *) M (* <= M *) = struct
+  let (* M.bar => *) bar (* <= M.bar *) = 42
+end
+
+include M (* ? M *)
+let _ = bar (* ? M.bar *)

File tests/inherit.ml

View file
-class (* c => *) c = object
-  val (* x => *) x = 1 (* <= x *)
-end (* <= c *)
+class (* c => *) c (* <= c *) = object
+  val (* x => *) x (* <= x *) = 1 
+end 
 
 class nc = object
   inherit let _x = 1 in c (* ? c *)
 end
 
 class nnc = object
-  inherit (* nc => *) let _y = 1 in nc (* <= nc *) (* limitation *)
+  inherit let _y = 1 in (* nc => *) nc (* <= nc *) (* limitation *)
   method n = y (* ? nc *)
 end

File tests/object.ml

View file
-class (* c0 => *) c0 = object
+class (* c0 => *) c0 (* <= c0 *) = object
   val a = 1
   method m = a
 end 
-(* <= c0 *)
 
-class (* c => *) c ((* p => *) p (* <= p *) : int) = 
+
+class (* c => *) c (* <= c *) ((* p => *) p (* <= p *) : int) = 
   let (* x => *) x (* <= x *) = 1 in
   let p' = p (* ? p *) in
-  object (* self => *)(self)(* <= self *)
+  object ((* self => *)self(* <= self *))
     inherit (* a => *) c0 (* <= a *)
 
-    val (* y => *) mutable y = x (* <= y *)
+    val mutable (* y => *) y (* <= y *) = x
     val z = x (* ? x *)
     val p'' = p (* ? p *)
     method f () = x (* ? x *)
     initializer
       y <- 42
   end
-(* <= c *)
+
 
 let _ = 
   let (* o => *) o (* <= o *) : c (* ? c *) = new c (* ? c *) 42 in
 let o = 
   let (* yy => *) yy (* <= yy *) = 2 in
 object 
-  val (* xx => *) xx = 1 (* <= xx *) 
+  val (* xx => *) xx (* <= xx *) = 1 
   method get_xx = xx (* ? xx *) 
   method get_yy = yy (* ? yy *)
 end

File tests/override_x.ml

View file
 module M = struct
-  type (* type x => *) x = Foo (* <= type x *)
+  type x = (* type Foo => *) Foo (* <= type Foo *)
   let (* x1 => *) x (* <= x1 *) = 1
   let y = x (* ? x1 *)
   let (* x2 => *) x (* <= x2 *) = 2
   let z = x (* ? x2 *)
-  let _ = Foo (* ? type x *)
+  let _ = Foo (* ? type Foo *)
 end
 
 let _ = M.x (* ? x2 *)
-let _ = M.Foo (* ? type x *)
+let _ = M.Foo (* ? type Foo *)

File tests/record.ml

View file
-type (* t => *) t = { foo : int ; bar : float } (* <= t *)
+type t = { (* t => *) foo (* <= t *) : int ; bar : float } 
     
 let x = { foo (* ? t *) = 1; bar = 4.2 }
 let _ = x.foo (* ? t *)

File tests/target.ml

View file
 (* Target *)
 
-(* Target.E => *) exception E (* <= Target.E *)
+exception (* Target.E => *) E (* <= Target.E *)
 let int = 1
 
 external external_value : int -> int = "external_value_impl"

File tests/test13.ml

View file
-type (* type t => *) t (* <= type t *) = Foo | Bar of int 
+type (* type t => *) t (* <= type t *) = (* Foo => *) Foo (* <= Foo *) | (* Bar => *) Bar (* <= Bar *) of int 
 
-let _ = Foo (* ? type t *)
-let _ = Bar (* ? type t *) 1
+let _ = Foo (* ? Foo *)
+let _ = Bar (* ? Bar *) 1
 
 type u = A of v (* ? type v *)
-and (* type v => *) v (* <= type v *) = B of u | C 
+and (* type v => *) v (* <= type v *) = (* B => *) B (* <= B *) of u | (* C => *) C  (* <= C *)
 
-let _ = A C (* ? type v *)
-let _ = B (* ? type v *) (A C)
+let _ = A C (* ? C *)
+let _ = B (* ? B *) (A C)
 
-type (* type x => *) x (* <= type x *) = { y : int } 
+type (* type x => *) x (* <= type x *) = { (* x.y => *) y (* <= x.y *) : int } 
 
 let (* x => *) x (* <= x *) = { y = 1 } (* ? type x *)
 
-let _ = function Foo (* ? type t *) -> 1 | Bar (* ? type t *) n -> n
+let _ = function Foo (* ? Foo *) -> 1 | Bar (* ? Bar *) n -> n
 
 let _ = 
   match { y = 1 } (* ? type x *) with
   | { y = (* n => *) n (* <= n *) } (* ? type x *) -> n (* ? n *)
 
-let _ = x(* ? x *).y (* ? type x *) 
+let _ = x(* ? x *).y (* ? x.y *) 
 
 let _ = fun ((* fun x => *) x (* <= fun x *) : t (* ? type t *)) -> x (* ? fun x *) 
 
 and 'a (* type vv => *) vv (* <= type vv *) = Bar of 'a uu 
 
 module M = struct
-  type (* type typ => *) typ (* <= type typ *) = F 
+  type (* type typ => *) typ (* <= type typ *) = (* M.F => *) F (* <= M.F *)
   let (* value typ => *) typ (* <= value typ *) = 1
 end
 
 type mt = M.typ (* ? type typ *)
 
-let _ = (M.F (* ? type typ *) : M.typ (* ? type typ *))
+let _ = (M.F (* ? M.F *) : M.typ (* ? type typ *))
 let _ = M.typ (* ? value typ *)

File tests/test18.ml

View file
-type (* constr E => *) t = E (* <= constr E *)
+type t = (* constr E => *) E (* <= constr E *)
 
-module E = struct let (* module E => *) x (* <= module E *) = 1 end
+module E = struct let (* E.x => *) x (* <= E.x *) = 1 end
 
 module type (* modtype E => *) E (* <= modtype E *) = sig val x : int end 
 
 
 let _ = raise E (* ? exception E *)
 
-let _ = E.x (* ? module E *)
+let _ = E.x (* ? E.x *)
 
 module M : E (* ? modtype E *) = struct
   let x = 1

File tests/variant.ml

View file
 module M = struct
-  type (* M.t => *) t = Foo of int (* <= M.t *)
+  type t = (* M.t => *) Foo (* <= M.t *) of int 
 end
 
 let _ = M.Foo (* ? M.t *) 1

File tests/variant_constructor.ml

View file
+type t = (* constr E => *) E (* <= constr E *)
+
+let _ = E (* ? constr E *)