Commits

camlspotter committed 0783860

added tests

Comments (0)

Files changed (30)

testsuite/typeloc/array.ml

+let _ = [ [||]; [] ] (* ok *)
+

testsuite/typeloc/array_pat.ml

+let _ = function
+  | [||] -> 1  (* ok *)
+  | [] -> 2
+
+

testsuite/typeloc/const_constant.ml

+let _ = [ [];  (* constructor use: ok *)
+          1    (* constant use: ok *)
+        ]

testsuite/typeloc/const_constant_pat.ml

+let _ = function
+  | [] -> 1  (* construct in pattern: ok *)
+  | 1 -> 2   (* const in pattern: ok *) 

testsuite/typeloc/constraint.ml

+let _ = (1 : float) (* ok *)
+ 

testsuite/typeloc/constraint_pat.ml

+let f = function (1 : float) -> 2 (* ok *)
+ 

testsuite/typeloc/exn.ml

+let _ = [Exit; 1]

testsuite/typeloc/exn_pat.ml

+let _ = function
+  | Exit -> 1
+  | 2 -> 2

testsuite/typeloc/for.ml

+let _ = for i = true to 10 do () done (* ok *)
+
+

testsuite/typeloc/for2.ml

+let _ = for i = 0 to true do () done (* ok *)
+
+

testsuite/typeloc/fun.ml

+let _ = [(fun x -> x); 1]

testsuite/typeloc/fun_app.ml

+let f = 1
+let _ = f 2 
+(* NG? : 
+File "fun_app.ml", line 2, characters 8-9:
+Error: This expression is not a function; it cannot be applied
+*)
+

testsuite/typeloc/ifthen.ml

+let _ = if true then 1 (* NG. Detected but the location is wrong *)
+ 

testsuite/typeloc/ifthenelse.ml

+let f = if 1 then 1 else 2 (* ok *)
+

testsuite/typeloc/lazy.ml

+let _ = [lazy 1; 2] (* ok *)
+

testsuite/typeloc/lazy_pat.ml

+let _ = function
+  | lazy 1 -> 1 (* ok *)
+  | 2 -> 2

testsuite/typeloc/pvar.ml

+let _ = `A + 1  (* this is tricky! NG *)
+

testsuite/typeloc/pvar_pat.ml

+let _ = function
+  | `A -> ()  (* NG *)
+  | 1 -> ()

testsuite/typeloc/rec_field.ml

+type t = { x : int }
+
+let f x = (x.x,  (* NG *)
+           x + 1)
+

testsuite/typeloc/rec_field_pat.ml

+type t = { x : int }
+
+let f = function
+  | { x = x } -> x  (* NG *)
+  | 1 -> 1
+

testsuite/typeloc/record.ml

+type t = { x : int; y : int }
+
+let _ = [ { x = 1; y = 2 };  (* ok *)
+          [] ]

testsuite/typeloc/record_pat.ml

+type t = { x : int; y : int }
+
+let _ = function
+  | { x = 1; y = 2 } -> 1  (* ok *)
+  | [] -> 2

testsuite/typeloc/seq.ml

+let _ = 1; () (* ok , with -strict-sequence *)
+

testsuite/typeloc/try.ml

+let _ = try 1 with 1 -> 1 (* ok, but loc is not sure ? *)
+

testsuite/typeloc/tuple.ml

+let _ = [ (1,2);  (* tuple ok *)
+          [] ]

testsuite/typeloc/tuple_pat.ml

+let x = function
+  | (1,2) -> 3 (* ok *)
+  | [] -> 4
+ 

testsuite/typeloc/var.ml

+type t = Foo 
+
+let _ = [Foo;  (* ok *)
+         1]
+ 

testsuite/typeloc/var_pat.ml

+type t = Foo
+
+let _ = function 
+  | Foo -> 1    (* ok *)
+  | [] -> 2

testsuite/typeloc/when.ml

+let _ = function _ when 1 -> 1 (* ok? but the location is cryptic *)
+

testsuite/typeloc/while.ml

+let _ = while 1 do () done (* ok? the bool introduction location is crypting *)
+