Migrate tests/typing-warnings tests to ocamltest
parent
c9de090c6b
commit
caf803f19c
|
@ -1,19 +0,0 @@
|
|||
#**************************************************************************
|
||||
#* *
|
||||
#* OCaml *
|
||||
#* *
|
||||
#* Xavier Clerc, SED, INRIA Rocquencourt *
|
||||
#* *
|
||||
#* Copyright 2010 Institut National de Recherche en Informatique et *
|
||||
#* en Automatique. *
|
||||
#* *
|
||||
#* All rights reserved. This file is distributed under the terms of *
|
||||
#* the GNU Lesser General Public License version 2.1, with the *
|
||||
#* special exception on linking described in the file LICENSE. *
|
||||
#* *
|
||||
#**************************************************************************
|
||||
|
||||
BASEDIR=../..
|
||||
include $(BASEDIR)/makefiles/Makefile.toplevel
|
||||
include $(BASEDIR)/makefiles/Makefile.common
|
||||
TOPFLAGS = -w A -strict-sequence
|
|
@ -1,6 +1,5 @@
|
|||
- : unit = ()
|
||||
|
||||
# - : unit = ()
|
||||
#
|
||||
<----------------------------------------------------------------------
|
||||
To check the result file for this test, it suffices to look for "val"
|
||||
lines corresponding to toplevel answers. If they start with
|
||||
|
@ -15,61 +14,61 @@ then just above there should be the warning text for Warning 57
|
|||
then just above there should be *no* warning text.
|
||||
---------------------------------------------------------------------->
|
||||
|
||||
# type expr = Val of int | Rest
|
||||
# Characters 46-71:
|
||||
type expr = Val of int | Rest
|
||||
Characters 46-71:
|
||||
| ((Val x, _) | (_, Val x)) when x < 0 -> ()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 57: Ambiguous or-pattern variables under guard;
|
||||
variable x may match different arguments. (See manual section 9.5)
|
||||
val ambiguous_typical_example : expr * expr -> unit = <fun>
|
||||
# Note that an Assert_failure is expected just below.
|
||||
# Exception: Assert_failure ("//toplevel//", 25, 6).
|
||||
# val not_ambiguous__no_orpat : int option -> unit = <fun>
|
||||
# val not_ambiguous__no_guard : [< `A | `B | `C ] -> unit = <fun>
|
||||
# val not_ambiguous__no_patvar_in_guard :
|
||||
Note that an Assert_failure is expected just below.
|
||||
Exception: Assert_failure ("//toplevel//", 30, 6).
|
||||
val not_ambiguous__no_orpat : int option -> unit = <fun>
|
||||
val not_ambiguous__no_guard : [< `A | `B | `C ] -> unit = <fun>
|
||||
val not_ambiguous__no_patvar_in_guard :
|
||||
bool -> [> `B of 'a | `C of 'a ] -> unit = <fun>
|
||||
# val not_ambiguous__disjoint_cases : [> `B of bool | `C of bool ] -> unit =
|
||||
val not_ambiguous__disjoint_cases : [> `B of bool | `C of bool ] -> unit =
|
||||
<fun>
|
||||
# * * * val not_ambiguous__prefix_variables :
|
||||
val not_ambiguous__prefix_variables :
|
||||
[> `B of bool * 'a option * 'a option ] -> unit = <fun>
|
||||
# Characters 33-72:
|
||||
Characters 33-72:
|
||||
| (`B (x, _, Some y) | `B (x, Some y, _)) when y -> ignore x
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 57: Ambiguous or-pattern variables under guard;
|
||||
variable y may match different arguments. (See manual section 9.5)
|
||||
val ambiguous__y : [> `B of 'a * bool option * bool option ] -> unit = <fun>
|
||||
# * * * * * * * * val not_ambiguous__rhs_not_protected :
|
||||
val not_ambiguous__rhs_not_protected :
|
||||
[> `B of 'a * bool option * bool option ] -> unit = <fun>
|
||||
# Characters 35-74:
|
||||
Characters 35-74:
|
||||
| (`B (x, _, Some y) | `B (x, Some y, _)) when x < y -> ()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 57: Ambiguous or-pattern variables under guard;
|
||||
variable y may match different arguments. (See manual section 9.5)
|
||||
val ambiguous__x_y : [> `B of 'a * 'a option * 'a option ] -> unit = <fun>
|
||||
# Characters 37-76:
|
||||
Characters 37-76:
|
||||
| (`B (x, z, Some y) | `B (x, Some y, z)) when x < y || Some x = z -> ()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 57: Ambiguous or-pattern variables under guard;
|
||||
variables y,z may match different arguments. (See manual section 9.5)
|
||||
val ambiguous__x_y_z : [> `B of 'a * 'a option * 'a option ] -> unit = <fun>
|
||||
# val not_ambiguous__disjoint_in_depth :
|
||||
val not_ambiguous__disjoint_in_depth :
|
||||
[> `A of [> `B of bool | `C of bool ] ] -> unit = <fun>
|
||||
# val not_ambiguous__prefix_variables_in_depth :
|
||||
val not_ambiguous__prefix_variables_in_depth :
|
||||
[> `A of [> `B of bool * [> `C1 | `C2 ] ] ] -> unit = <fun>
|
||||
# Characters 40-76:
|
||||
Characters 40-76:
|
||||
| `A (`B (Some x, _) | `B (_, Some x)) when x -> ()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 57: Ambiguous or-pattern variables under guard;
|
||||
variable x may match different arguments. (See manual section 9.5)
|
||||
val ambiguous__in_depth :
|
||||
[> `A of [> `B of bool option * bool option ] ] -> unit = <fun>
|
||||
# val not_ambiguous__several_orpats :
|
||||
val not_ambiguous__several_orpats :
|
||||
[> `A of
|
||||
[> `B of 'a * 'b option * 'c option ] *
|
||||
[> `C of 'a * 'd option * 'e option ] *
|
||||
[> `D1 of 'f * 'a * 'g option * 'h | `D2 of 'i * 'a * 'j * 'k option ] ] ->
|
||||
unit = <fun>
|
||||
# Characters 43-140:
|
||||
Characters 43-140:
|
||||
....`A ((`B (Some x, _) | `B (_, Some x)),
|
||||
(`C (Some y, Some _, _) | `C (Some y, _, Some _))).................
|
||||
Warning 57: Ambiguous or-pattern variables under guard;
|
||||
|
@ -79,7 +78,7 @@ val ambiguous__first_orpat :
|
|||
[> `B of 'a option * 'a option ] *
|
||||
[> `C of 'a option * 'b option * 'c option ] ] ->
|
||||
unit = <fun>
|
||||
# Characters 44-141:
|
||||
Characters 44-141:
|
||||
....`A ((`B (Some x, Some _, _) | `B (Some x, _, Some _)),
|
||||
(`C (Some y, _) | `C (_, Some y))).................
|
||||
Warning 57: Ambiguous or-pattern variables under guard;
|
||||
|
@ -89,37 +88,37 @@ val ambiguous__second_orpat :
|
|||
[> `B of 'a option * 'b option * 'c option ] *
|
||||
[> `C of 'a option * 'a option ] ] ->
|
||||
unit = <fun>
|
||||
# val not_ambiguous__pairs : bool * 'a option * 'b option -> unit = <fun>
|
||||
# val not_ambiguous__vars : bool -> unit = <fun>
|
||||
# val not_ambiguous__as :
|
||||
val not_ambiguous__pairs : bool * 'a option * 'b option -> unit = <fun>
|
||||
val not_ambiguous__vars : bool -> unit = <fun>
|
||||
val not_ambiguous__as :
|
||||
('a list * 'b list -> bool) -> 'a list * 'b list -> unit = <fun>
|
||||
# val not_ambiguous__as_var : ('a list * 'b -> bool) -> 'a list * 'b -> unit =
|
||||
val not_ambiguous__as_var : ('a list * 'b -> bool) -> 'a list * 'b -> unit =
|
||||
<fun>
|
||||
# val not_ambiguous__var_as :
|
||||
val not_ambiguous__var_as :
|
||||
('a list * 'b -> bool) -> ('a list * 'b) * 'c option * 'd option -> unit =
|
||||
<fun>
|
||||
# val not_ambiguous__lazy : ('a list * 'b list) * bool lazy_t -> unit = <fun>
|
||||
# type t = A of int * int option * int option | B
|
||||
# val not_ambiguous__constructor : t -> unit = <fun>
|
||||
# type amoi = Z of int | Y of int * int | X of amoi * amoi
|
||||
# Characters 40-73:
|
||||
val not_ambiguous__lazy : ('a list * 'b list) * bool lazy_t -> unit = <fun>
|
||||
type t = A of int * int option * int option | B
|
||||
val not_ambiguous__constructor : t -> unit = <fun>
|
||||
type amoi = Z of int | Y of int * int | X of amoi * amoi
|
||||
Characters 40-73:
|
||||
..X (Z x,Y (y,0))
|
||||
| X (Z y,Y (x,_))
|
||||
Warning 57: Ambiguous or-pattern variables under guard;
|
||||
variables x,y may match different arguments. (See manual section 9.5)
|
||||
val ambiguous__amoi : amoi -> int = <fun>
|
||||
# module type S = sig val b : bool end
|
||||
# Characters 56-101:
|
||||
module type S = sig val b : bool end
|
||||
Characters 56-101:
|
||||
....(module M:S),_,(1,_)
|
||||
| _,(module M:S),(_,1)...................
|
||||
Warning 57: Ambiguous or-pattern variables under guard;
|
||||
variable M may match different arguments. (See manual section 9.5)
|
||||
val ambiguous__module_variable :
|
||||
(module S) * (module S) * (int * int) -> bool -> int = <fun>
|
||||
# val not_ambiguous__module_variable :
|
||||
val not_ambiguous__module_variable :
|
||||
(module S) * (module S) * (int * int) -> bool -> int = <fun>
|
||||
# type t2 = A of int * int | B of int * int
|
||||
# Characters 55-56:
|
||||
type t2 = A of int * int | B of int * int
|
||||
Characters 55-56:
|
||||
| A (x as z,(0 as y))|A (0 as y as z,x)|B (x,(y as z)) when g x (y+z) -> 1
|
||||
^
|
||||
Warning 41: A belongs to several types: t2 t
|
||||
|
@ -137,28 +136,28 @@ Warning 57: Ambiguous or-pattern variables under guard;
|
|||
variables x,y may match different arguments. (See manual section 9.5)
|
||||
val ambiguous_xy_but_not_ambiguous_z : (int -> int -> bool) -> t2 -> int =
|
||||
<fun>
|
||||
# * * * * * * * * val not_ambiguous__as_disjoint_on_second_column_split :
|
||||
val not_ambiguous__as_disjoint_on_second_column_split :
|
||||
int option * int -> unit = <fun>
|
||||
# no warning below
|
||||
# * val solved_ambiguity_typical_example : expr * expr -> unit = <fun>
|
||||
# yet a warning below
|
||||
# * Characters 164-189:
|
||||
no warning below
|
||||
val solved_ambiguity_typical_example : expr * expr -> unit = <fun>
|
||||
yet a warning below
|
||||
Characters 164-189:
|
||||
| ((Val y, _) | (_, Val y)) when y < 0 -> ()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 57: Ambiguous or-pattern variables under guard;
|
||||
variable y may match different arguments. (See manual section 9.5)
|
||||
val guarded_ambiguity : expr * expr -> unit = <fun>
|
||||
# type a = A1 | A2
|
||||
# type 'a alg = Val of 'a | Binop of 'a alg * 'a alg
|
||||
# warning below
|
||||
# Characters 100-125:
|
||||
type a = A1 | A2
|
||||
type 'a alg = Val of 'a | Binop of 'a alg * 'a alg
|
||||
warning below
|
||||
Characters 100-125:
|
||||
| ((Val x, _) | (_, Val x)) when pred x -> ()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 57: Ambiguous or-pattern variables under guard;
|
||||
variable x may match different arguments. (See manual section 9.5)
|
||||
val cmp : (a -> bool) -> a alg -> a alg -> unit = <fun>
|
||||
# type a = A1
|
||||
# type 'a alg = Val of 'a | Binop of 'a alg * 'a alg
|
||||
# no warning below
|
||||
# val cmp : (a -> bool) -> a alg -> a alg -> unit = <fun>
|
||||
#
|
||||
type a = A1
|
||||
type 'a alg = Val of 'a | Binop of 'a alg * 'a alg
|
||||
no warning below
|
||||
val cmp : (a -> bool) -> a alg -> a alg -> unit = <fun>
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
(* TEST
|
||||
flags = " -w A -strict-sequence "
|
||||
* toplevel
|
||||
*)
|
||||
|
||||
(* Ignore OCAMLRUNPARAM=b to be reproducible *)
|
||||
Printexc.record_backtrace false;;
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
# - : unit = ()
|
||||
# Characters 16-19:
|
||||
- : unit = ()
|
||||
Characters 16-19:
|
||||
let _ = ignore (+);;
|
||||
^^^
|
||||
Warning 5: this function application is partial,
|
||||
maybe some arguments are missing.
|
||||
- : unit = ()
|
||||
# Characters 19-20:
|
||||
Characters 19-20:
|
||||
let _ = raise Exit 3;;
|
||||
^
|
||||
Warning 20: this argument will not be used by the function.
|
||||
Exception: Pervasives.Exit.
|
||||
#
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
(* TEST
|
||||
flags = " -w A -strict-sequence "
|
||||
* toplevel
|
||||
*)
|
||||
|
||||
(* Ignore OCAMLRUNPARAM=b to be reproducible *)
|
||||
Printexc.record_backtrace false;;
|
||||
|
||||
|
|
|
@ -1,26 +1,25 @@
|
|||
|
||||
# Characters 76-79:
|
||||
Characters 168-171:
|
||||
fun b -> if b then format_of_string "x" else "y";;
|
||||
^^^
|
||||
Warning 18: this coercion to format6 is not principal.
|
||||
- : bool -> ('a, 'b, 'c, 'd, 'd, 'a) format6 = <fun>
|
||||
# Characters 28-48:
|
||||
Characters 28-48:
|
||||
fun b -> if b then "x" else format_of_string "y";;
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
Error: This expression has type
|
||||
('a, 'b, 'c, 'd, 'd, 'a) format6 =
|
||||
('a, 'b, 'c, 'd, 'd, 'a) CamlinternalFormatBasics.format6
|
||||
but an expression was expected of type string
|
||||
# - : bool -> ('a, 'b, 'a) format = <fun>
|
||||
# module PR7135 :
|
||||
- : bool -> ('a, 'b, 'a) format = <fun>
|
||||
module PR7135 :
|
||||
sig
|
||||
module M : sig type t = private int end
|
||||
type t = M.t
|
||||
val lift2 : (int -> int -> int) -> t -> t -> int
|
||||
end
|
||||
# Characters 133-143:
|
||||
Characters 133-143:
|
||||
let f x = let y = if true then x else (x:t) in (y :> int)
|
||||
^^^^^^^^^^
|
||||
Warning 18: this ground coercion is not principal.
|
||||
module Test1 : sig type t = private int val f : t -> int end
|
||||
#
|
||||
|
|
@ -1,18 +1,17 @@
|
|||
|
||||
# - : bool -> ('a, 'b, 'c, 'd, 'd, 'a) format6 = <fun>
|
||||
# Characters 28-48:
|
||||
- : bool -> ('a, 'b, 'c, 'd, 'd, 'a) format6 = <fun>
|
||||
Characters 28-48:
|
||||
fun b -> if b then "x" else format_of_string "y";;
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
Error: This expression has type
|
||||
('a, 'b, 'c, 'd, 'd, 'a) format6 =
|
||||
('a, 'b, 'c, 'd, 'd, 'a) CamlinternalFormatBasics.format6
|
||||
but an expression was expected of type string
|
||||
# - : bool -> ('a, 'b, 'a) format = <fun>
|
||||
# module PR7135 :
|
||||
- : bool -> ('a, 'b, 'a) format = <fun>
|
||||
module PR7135 :
|
||||
sig
|
||||
module M : sig type t = private int end
|
||||
type t = M.t
|
||||
val lift2 : (int -> int -> int) -> t -> t -> int
|
||||
end
|
||||
# module Test1 : sig type t = private int val f : t -> int end
|
||||
#
|
||||
module Test1 : sig type t = private int val f : t -> int end
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
(* TEST
|
||||
flags = " -w A -strict-sequence "
|
||||
* toplevel
|
||||
* toplevel with principal
|
||||
*)
|
||||
|
||||
(* comment 9644 of PR#6000 *)
|
||||
|
||||
fun b -> if b then format_of_string "x" else "y";;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
# Characters 58-110:
|
||||
Characters 121-173:
|
||||
........function
|
||||
None, None -> 1
|
||||
| Some _, Some _ -> 2..
|
||||
|
@ -7,10 +6,10 @@ Warning 8: this pattern-matching is not exhaustive.
|
|||
Here is an example of a case that is not matched:
|
||||
((Some _, None)|(None, Some _))
|
||||
val f : 'a option * 'b option -> int = <fun>
|
||||
# type _ t = A : int t | B : bool t | C : char t | D : float t
|
||||
type _ t = A : int t | B : bool t | C : char t | D : float t
|
||||
type (_, _, _, _) u = U : (int, int, int, int) u
|
||||
type v = E | F | G
|
||||
# Characters 124-205:
|
||||
Characters 124-205:
|
||||
.function A, A, A, A, A, A, A, _, U, U -> 1
|
||||
| _, _, _, _, _, _, _, G, _, _ -> 1
|
||||
Warning 8: this pattern-matching is not exhaustive.
|
||||
|
@ -24,7 +23,7 @@ Consider replacing it with a refutation case '<pat> -> .'
|
|||
val f :
|
||||
'a t * 'b t * 'c t * 'd t * 'e t * 'f t * 'g t * v * ('a, 'b, 'c, 'd) u *
|
||||
('e, 'f, 'g, 'g) u -> int = <fun>
|
||||
# Characters 40-68:
|
||||
Characters 40-68:
|
||||
let f (x : int t) = match x with A -> 1 | _ -> 2;; (* warn *)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 4: this pattern-matching is fragile.
|
||||
|
@ -35,112 +34,112 @@ Characters 62-63:
|
|||
Warning 56: this match case is unreachable.
|
||||
Consider replacing it with a refutation case '<pat> -> .'
|
||||
val f : int t -> int = <fun>
|
||||
# Characters 53-54:
|
||||
Characters 53-54:
|
||||
let f (x : unit t option) = match x with None -> 1 | _ -> 2 ;; (* warn? *)
|
||||
^
|
||||
Warning 56: this match case is unreachable.
|
||||
Consider replacing it with a refutation case '<pat> -> .'
|
||||
val f : unit t option -> int = <fun>
|
||||
# Characters 53-59:
|
||||
Characters 53-59:
|
||||
let f (x : unit t option) = match x with None -> 1 | Some _ -> 2 ;; (* warn *)
|
||||
^^^^^^
|
||||
Warning 56: this match case is unreachable.
|
||||
Consider replacing it with a refutation case '<pat> -> .'
|
||||
val f : unit t option -> int = <fun>
|
||||
# val f : int t option -> int = <fun>
|
||||
# Characters 27-49:
|
||||
val f : int t option -> int = <fun>
|
||||
Characters 27-49:
|
||||
let f (x : int t option) = match x with None -> 1;; (* warn *)
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 8: this pattern-matching is not exhaustive.
|
||||
Here is an example of a case that is not matched:
|
||||
Some A
|
||||
val f : int t option -> int = <fun>
|
||||
# type 'a box = Box of 'a
|
||||
type 'a box = Box of 'a
|
||||
type 'a pair = { left : 'a; right : 'a; }
|
||||
# Characters 50-69:
|
||||
Characters 50-69:
|
||||
let f : (int t box pair * bool) option -> unit = function None -> ();;
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
Warning 8: this pattern-matching is not exhaustive.
|
||||
Here is an example of a case that is not matched:
|
||||
Some ({left=Box A; right=Box A}, _)
|
||||
val f : (int t box pair * bool) option -> unit = <fun>
|
||||
# val f : (string t box pair * bool) option -> unit = <fun>
|
||||
# Characters 8-39:
|
||||
val f : (string t box pair * bool) option -> unit = <fun>
|
||||
Characters 8-39:
|
||||
let f = function {left=Box 0; _ } -> ();;
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 8: this pattern-matching is not exhaustive.
|
||||
Here is an example of a case that is not matched:
|
||||
{left=Box 1; _ }
|
||||
val f : int box pair -> unit = <fun>
|
||||
# Characters 8-47:
|
||||
Characters 8-47:
|
||||
let f = function {left=Box 0;right=Box 1} -> ();;
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 8: this pattern-matching is not exhaustive.
|
||||
Here is an example of a case that is not matched:
|
||||
{left=Box 0; right=Box 0}
|
||||
val f : int box pair -> unit = <fun>
|
||||
# type _ t = Int : int t | Bool : bool t
|
||||
# val f : 'a t -> 'a = <fun>
|
||||
# val g : int t -> int = <fun>
|
||||
# val h : 'a t -> 'a t -> bool = <fun>
|
||||
# type (_, _) cmp = Eq : ('a, 'a) cmp | Any : ('a, 'b) cmp
|
||||
type _ t = Int : int t | Bool : bool t
|
||||
val f : 'a t -> 'a = <fun>
|
||||
val g : int t -> int = <fun>
|
||||
val h : 'a t -> 'a t -> bool = <fun>
|
||||
type (_, _) cmp = Eq : ('a, 'a) cmp | Any : ('a, 'b) cmp
|
||||
module A : sig type a type b val eq : (a, b) cmp end
|
||||
# Characters 33-51:
|
||||
Characters 33-51:
|
||||
let f : (A.a, A.b) cmp -> unit = function Any -> ()
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
Warning 8: this pattern-matching is not exhaustive.
|
||||
Here is an example of a case that is not matched:
|
||||
Eq
|
||||
val f : (A.a, A.b) cmp -> unit = <fun>
|
||||
# val deep : char t option -> char = <fun>
|
||||
# type zero = Zero
|
||||
val deep : char t option -> char = <fun>
|
||||
type zero = Zero
|
||||
type _ succ = Succ
|
||||
# type (_, _, _) plus =
|
||||
type (_, _, _) plus =
|
||||
Plus0 : (zero, 'a, 'a) plus
|
||||
| PlusS : ('a, 'b, 'c) plus -> ('a succ, 'b, 'c succ) plus
|
||||
# val trivial : (zero succ, zero, zero) plus option -> bool = <fun>
|
||||
# val easy : (zero, zero succ, zero) plus option -> bool = <fun>
|
||||
# Characters 71-93:
|
||||
val trivial : (zero succ, zero, zero) plus option -> bool = <fun>
|
||||
val easy : (zero, zero succ, zero) plus option -> bool = <fun>
|
||||
Characters 71-93:
|
||||
function None -> false
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 8: this pattern-matching is not exhaustive.
|
||||
Here is an example of a case that is not matched:
|
||||
Some (PlusS _)
|
||||
val harder : (zero succ, zero succ, zero succ) plus option -> bool = <fun>
|
||||
# val harder : (zero succ, zero succ, zero succ) plus option -> bool = <fun>
|
||||
# val inv_zero : ('a, 'b, 'c) plus -> ('c, 'd, zero) plus -> bool = <fun>
|
||||
# type _ t = Int : int t
|
||||
# val f : bool t -> 'a = <fun>
|
||||
# Characters 54-55:
|
||||
val harder : (zero succ, zero succ, zero succ) plus option -> bool = <fun>
|
||||
val inv_zero : ('a, 'b, 'c) plus -> ('c, 'd, zero) plus -> bool = <fun>
|
||||
type _ t = Int : int t
|
||||
val f : bool t -> 'a = <fun>
|
||||
Characters 54-55:
|
||||
let f () = match None with _ -> .;; (* error *)
|
||||
^
|
||||
Error: This match case could not be refuted.
|
||||
Here is an example of a value that would reach it: _
|
||||
# Characters 47-48:
|
||||
Characters 47-48:
|
||||
let g () = match None with _ -> () | exception _ -> .;; (* error *)
|
||||
^
|
||||
Error: This match case could not be refuted.
|
||||
Here is an example of a value that would reach it: _
|
||||
# Characters 27-28:
|
||||
Characters 27-28:
|
||||
let h () = match None with _ -> . | exception _ -> .;; (* error *)
|
||||
^
|
||||
Error: This match case could not be refuted.
|
||||
Here is an example of a value that would reach it: _
|
||||
# val f : 'a option -> unit = <fun>
|
||||
# Characters 47-77:
|
||||
val f : 'a option -> unit = <fun>
|
||||
Characters 47-77:
|
||||
let f x y = match 1 with 1 when x = y -> 1;;
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 8: this pattern-matching is not exhaustive.
|
||||
All clauses in this pattern-matching are guarded.
|
||||
val f : 'a -> 'a -> int = <fun>
|
||||
# Characters 62-91:
|
||||
Characters 62-91:
|
||||
let f = function {contents=_}, 0 -> 0;;
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 8: this pattern-matching is not exhaustive.
|
||||
Here is an example of a case that is not matched:
|
||||
(_, 1)
|
||||
val f : 'a ref * int -> int = <fun>
|
||||
# Characters 68-148:
|
||||
Characters 68-148:
|
||||
........function
|
||||
| None -> ()
|
||||
| Some x when x > 0 -> ()
|
||||
|
@ -150,4 +149,4 @@ Here is an example of a case that is not matched:
|
|||
Some _
|
||||
(However, some guarded clause may match this value.)
|
||||
val f : int option -> unit = <fun>
|
||||
#
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
(* TEST
|
||||
flags = " -w A -strict-sequence "
|
||||
* toplevel
|
||||
*)
|
||||
|
||||
(* Warn about all relevant cases when possible *)
|
||||
let f = function
|
||||
None, None -> 1
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
ambiguous_guarded_disjunction.ml
|
||||
application.ml
|
||||
coercions.ml
|
||||
exhaustiveness.ml
|
||||
pr5892.ml
|
||||
pr6587.ml
|
||||
pr6872.ml
|
||||
pr7085.ml
|
||||
pr7115.ml
|
||||
pr7261.ml
|
||||
pr7297.ml
|
||||
pr7553.ml
|
||||
records.ml
|
||||
unused_types.ml
|
|
@ -1,12 +1,11 @@
|
|||
|
||||
# # type _ choice =
|
||||
type _ choice =
|
||||
Left : CamlinternalOO.label choice
|
||||
| Right : CamlinternalOO.tag choice
|
||||
# Characters 31-52:
|
||||
Characters 31-52:
|
||||
let f : label choice -> bool = function Left -> true;; (* warn *)
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 8: this pattern-matching is not exhaustive.
|
||||
Here is an example of a case that is not matched:
|
||||
Right
|
||||
val f : CamlinternalOO.label choice -> bool = <fun>
|
||||
#
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
(* TEST
|
||||
flags = " -w A -strict-sequence "
|
||||
* toplevel
|
||||
*)
|
||||
|
||||
open CamlinternalOO;;
|
||||
type _ choice = Left : label choice | Right : tag choice;;
|
||||
let f : label choice -> bool = function Left -> true;; (* warn *)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
# module A : sig val f : fpclass -> fpclass end
|
||||
# type fpclass = A
|
||||
# Characters 49-85:
|
||||
module A : sig val f : fpclass -> fpclass end
|
||||
type fpclass = A
|
||||
Characters 49-85:
|
||||
..struct
|
||||
let f A = FP_normal
|
||||
end
|
||||
|
@ -14,4 +13,4 @@ Error: Signature mismatch:
|
|||
val f : fpclass -> Pervasives.fpclass
|
||||
is not included in
|
||||
val f : fpclass -> fpclass
|
||||
#
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
(* TEST
|
||||
flags = " -w A -strict-sequence "
|
||||
* toplevel
|
||||
*)
|
||||
|
||||
|
||||
module A: sig val f: fpclass -> fpclass end =
|
||||
struct
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
|
||||
# - : unit = ()
|
||||
# exception A
|
||||
# type a = A
|
||||
# Characters 1-2:
|
||||
- : unit = ()
|
||||
exception A
|
||||
type a = A
|
||||
Characters 1-2:
|
||||
A;;
|
||||
^
|
||||
Warning 41: A belongs to several types: a exn
|
||||
The first one was selected. Please disambiguate if this is wrong.
|
||||
- : a = A
|
||||
# Characters 6-7:
|
||||
Characters 6-7:
|
||||
raise A;;
|
||||
^
|
||||
Warning 42: this use of A relies on type-directed disambiguation,
|
||||
it will not compile with OCaml 4.00 or earlier.
|
||||
Exception: A.
|
||||
# - : a -> unit = <fun>
|
||||
# Characters 26-27:
|
||||
- : a -> unit = <fun>
|
||||
Characters 26-27:
|
||||
function Not_found -> 1 | A -> 2 | _ -> 3;;
|
||||
^
|
||||
Warning 41: A belongs to several types: a exn
|
||||
|
@ -25,7 +24,7 @@ Characters 26-27:
|
|||
^
|
||||
Error: This pattern matches values of type a
|
||||
but a pattern was expected which matches values of type exn
|
||||
# Characters 10-11:
|
||||
Characters 10-11:
|
||||
try raise A with A -> 2;;
|
||||
^
|
||||
Warning 42: this use of A relies on type-directed disambiguation,
|
||||
|
@ -36,4 +35,4 @@ Characters 17-18:
|
|||
Warning 42: this use of A relies on type-directed disambiguation,
|
||||
it will not compile with OCaml 4.00 or earlier.
|
||||
- : int = 2
|
||||
#
|
||||
|
|
@ -1,27 +1,26 @@
|
|||
|
||||
# - : unit = ()
|
||||
# exception A
|
||||
# type a = A
|
||||
# Characters 1-2:
|
||||
- : unit = ()
|
||||
exception A
|
||||
type a = A
|
||||
Characters 1-2:
|
||||
A;;
|
||||
^
|
||||
Warning 41: A belongs to several types: a exn
|
||||
The first one was selected. Please disambiguate if this is wrong.
|
||||
- : a = A
|
||||
# Characters 6-7:
|
||||
Characters 6-7:
|
||||
raise A;;
|
||||
^
|
||||
Warning 42: this use of A relies on type-directed disambiguation,
|
||||
it will not compile with OCaml 4.00 or earlier.
|
||||
Exception: A.
|
||||
# - : a -> unit = <fun>
|
||||
# Characters 26-27:
|
||||
- : a -> unit = <fun>
|
||||
Characters 26-27:
|
||||
function Not_found -> 1 | A -> 2 | _ -> 3;;
|
||||
^
|
||||
Warning 42: this use of A relies on type-directed disambiguation,
|
||||
it will not compile with OCaml 4.00 or earlier.
|
||||
- : exn -> int = <fun>
|
||||
# Characters 10-11:
|
||||
Characters 10-11:
|
||||
try raise A with A -> 2;;
|
||||
^
|
||||
Warning 42: this use of A relies on type-directed disambiguation,
|
||||
|
@ -32,4 +31,4 @@ Characters 17-18:
|
|||
Warning 42: this use of A relies on type-directed disambiguation,
|
||||
it will not compile with OCaml 4.00 or earlier.
|
||||
- : int = 2
|
||||
#
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
(* TEST
|
||||
flags = " -w A -strict-sequence "
|
||||
* toplevel
|
||||
* toplevel with principal
|
||||
*)
|
||||
|
||||
(* Ignore OCAMLRUNPARAM=b to be reproducible *)
|
||||
Printexc.record_backtrace false;;
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
# Characters 292-322:
|
||||
Characters 355-385:
|
||||
match M.is_t () with None -> 0
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 8: this pattern-matching is not exhaustive.
|
||||
|
@ -12,9 +11,9 @@ module type T =
|
|||
val is_t : unit -> unit is_t option
|
||||
end
|
||||
module Make : functor (M : T) -> sig val f : unit -> int end
|
||||
# Characters 89-90:
|
||||
Characters 89-90:
|
||||
let g : t -> int = function _ -> .
|
||||
^
|
||||
Error: This match case could not be refuted.
|
||||
Here is an example of a value that would reach it: T (Is Eq)
|
||||
#
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
(* TEST
|
||||
flags = " -w A -strict-sequence "
|
||||
* toplevel
|
||||
*)
|
||||
|
||||
module TypEq = struct
|
||||
type (_, _) t = Eq : ('a, 'a) t
|
||||
end
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
|
||||
# type t = A : t
|
||||
# Characters 40-41:
|
||||
type t = A : t
|
||||
Characters 40-41:
|
||||
let _f ~x (* x unused argument *) = function
|
||||
^
|
||||
Warning 27: unused variable x.
|
||||
module X1 : sig end
|
||||
# Characters 36-37:
|
||||
Characters 36-37:
|
||||
let x = 42 (* unused value *)
|
||||
^
|
||||
Warning 32: unused value x.
|
||||
module X2 : sig end
|
||||
# Characters 54-55:
|
||||
Characters 54-55:
|
||||
module O = struct let x = 42 (* unused *) end
|
||||
^
|
||||
Warning 32: unused value x.
|
||||
|
@ -19,4 +18,4 @@ Characters 80-86:
|
|||
^^^^^^
|
||||
Warning 33: unused open O.
|
||||
module X3 : sig end
|
||||
#
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
(* TEST
|
||||
flags = " -w A -strict-sequence "
|
||||
* toplevel
|
||||
*)
|
||||
|
||||
type t = A : t;;
|
||||
|
||||
module X1 : sig end = struct
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
|
||||
# Characters 30-32:
|
||||
Characters 93-95:
|
||||
Foo: [> `Bla ] as 'b ) * 'b -> foo;;
|
||||
^^
|
||||
Error: Syntax error
|
||||
# Characters 46-60:
|
||||
Characters 46-60:
|
||||
Foo: 'b * 'b -> foo constraint 'b = [> `Bla ];;
|
||||
^^^^^^^^^^^^^^
|
||||
Warning 62: Type constraints do not apply to GADT cases of variant types.
|
||||
type foo = Foo : 'b * 'b -> foo
|
||||
#
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
(* TEST
|
||||
flags = " -w A -strict-sequence "
|
||||
* toplevel
|
||||
*)
|
||||
|
||||
type foo =
|
||||
Foo: [> `Bla ] as 'b ) * 'b -> foo;;
|
||||
type foo =
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
# - : unit = ()
|
||||
# Characters 10-20:
|
||||
- : unit = ()
|
||||
Characters 10-20:
|
||||
let () = raise Exit; () ;; (* warn *)
|
||||
^^^^^^^^^^
|
||||
Warning 21: this statement never returns (or has an unsound type.)
|
||||
Exception: Pervasives.Exit.
|
||||
#
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
(* TEST
|
||||
flags = " -w A -strict-sequence "
|
||||
* toplevel
|
||||
*)
|
||||
|
||||
(* Ignore OCAMLRUNPARAM=b to be reproducible *)
|
||||
Printexc.record_backtrace false;;
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
|
||||
# module A : sig type foo end
|
||||
# module rec B : sig type bar = Bar of A.foo end
|
||||
# Characters 22-28:
|
||||
module A : sig type foo end
|
||||
module rec B : sig type bar = Bar of A.foo end
|
||||
Characters 22-28:
|
||||
open A
|
||||
^^^^^^
|
||||
Warning 33: unused open A.
|
||||
module rec C : sig end
|
||||
# Characters 110-114:
|
||||
Characters 110-114:
|
||||
let None = None
|
||||
^^^^
|
||||
Warning 8: this pattern-matching is not exhaustive.
|
||||
|
@ -17,4 +16,4 @@ Characters 93-99:
|
|||
^^^^^^
|
||||
Warning 33: unused open A.
|
||||
module rec D : sig module M : sig module X : sig end end end
|
||||
#
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
(* TEST
|
||||
flags = " -w A -strict-sequence "
|
||||
* toplevel
|
||||
*)
|
||||
|
||||
module A = struct type foo end;;
|
||||
|
||||
module rec B : sig
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
# module M1 :
|
||||
module M1 :
|
||||
sig type t = { x : int; y : int; } type u = { x : bool; y : bool; } end
|
||||
# Characters 49-50:
|
||||
Characters 49-50:
|
||||
let f1 (r:t) = r.x (* ok *)
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -31,7 +30,7 @@ Characters 148-149:
|
|||
Warning 27: unused variable x.
|
||||
module OK :
|
||||
sig val f1 : M1.t -> int val f2 : M1.t -> int val f3 : M1.t -> int end
|
||||
# Characters 55-61:
|
||||
Characters 55-61:
|
||||
let f r = match r with {x; y} -> y + y
|
||||
^^^^^^
|
||||
Warning 41: these field labels belong to several types: M1.u M1.t
|
||||
|
@ -41,7 +40,7 @@ Characters 65-66:
|
|||
^
|
||||
Error: This expression has type bool but an expression was expected of type
|
||||
int
|
||||
# Characters 85-91:
|
||||
Characters 85-91:
|
||||
{x; y} -> y + y
|
||||
^^^^^^
|
||||
Warning 41: these field labels belong to several types: M1.u M1.t
|
||||
|
@ -51,14 +50,14 @@ Characters 85-91:
|
|||
^^^^^^
|
||||
Error: This pattern matches values of type M1.u
|
||||
but a pattern was expected which matches values of type M1.t
|
||||
# module M : sig type t = { x : int; } type u = { x : bool; } end
|
||||
# Characters 18-21:
|
||||
module M : sig type t = { x : int; } type u = { x : bool; } end
|
||||
Characters 18-21:
|
||||
let f (r:M.t) = r.M.x;; (* ok *)
|
||||
^^^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
it will not compile with OCaml 4.00 or earlier.
|
||||
val f : M.t -> int = <fun>
|
||||
# Characters 18-19:
|
||||
Characters 18-19:
|
||||
let f (r:M.t) = r.x;; (* warning *)
|
||||
^
|
||||
Warning 40: x was selected from type M.t.
|
||||
|
@ -70,7 +69,7 @@ Characters 18-19:
|
|||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
it will not compile with OCaml 4.00 or earlier.
|
||||
val f : M.t -> int = <fun>
|
||||
# Characters 8-9:
|
||||
Characters 8-9:
|
||||
let f ({x}:M.t) = x;; (* warning *)
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -82,9 +81,9 @@ Warning 40: this record of type M.t contains fields that are
|
|||
not visible in the current scope: x.
|
||||
They will not be selected if the type becomes unknown.
|
||||
val f : M.t -> int = <fun>
|
||||
# module M : sig type t = { x : int; y : int; } end
|
||||
# module N : sig type u = { x : bool; y : bool; } end
|
||||
# Characters 57-58:
|
||||
module M : sig type t = { x : int; y : int; } end
|
||||
module N : sig type u = { x : bool; y : bool; } end
|
||||
Characters 57-58:
|
||||
let f (r:M.t) = r.x
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -94,19 +93,19 @@ Characters 30-36:
|
|||
^^^^^^
|
||||
Warning 33: unused open N.
|
||||
module OK : sig val f : M.t -> int end
|
||||
# module M :
|
||||
module M :
|
||||
sig
|
||||
type t = { x : int; }
|
||||
module N : sig type s = t = { x : int; } end
|
||||
type u = { x : bool; }
|
||||
end
|
||||
# module OK : sig val f : M.t -> int end
|
||||
# module M :
|
||||
module OK : sig val f : M.t -> int end
|
||||
module M :
|
||||
sig
|
||||
type u = { x : bool; y : int; z : char; }
|
||||
type t = { x : int; y : bool; }
|
||||
end
|
||||
# Characters 37-38:
|
||||
Characters 37-38:
|
||||
let f {x;z} = x,z
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -118,11 +117,11 @@ Warning 9: the following labels are not bound in this record pattern:
|
|||
y
|
||||
Either bind these labels explicitly or add '; _' to the pattern.
|
||||
module OK : sig val f : M.u -> bool * char end
|
||||
# Characters 38-52:
|
||||
Characters 38-52:
|
||||
let r = {x=true;z='z'}
|
||||
^^^^^^^^^^^^^^
|
||||
Error: Some record fields are undefined: y
|
||||
# Characters 90-91:
|
||||
Characters 90-91:
|
||||
let r = {x=3; y=true}
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -138,19 +137,19 @@ module OK :
|
|||
type t = { x : bool; y : int; z : char; }
|
||||
val r : u
|
||||
end
|
||||
# Characters 111-112:
|
||||
Characters 111-112:
|
||||
let b : bar = {x=3; y=4}
|
||||
^
|
||||
Error: This record expression is expected to have type bar
|
||||
The field y does not belong to type bar
|
||||
# module M : sig type foo = { x : int; y : int; } end
|
||||
# module N : sig type bar = { x : int; y : int; } end
|
||||
# Characters 19-22:
|
||||
module M : sig type foo = { x : int; y : int; } end
|
||||
module N : sig type bar = { x : int; y : int; } end
|
||||
Characters 19-22:
|
||||
let r = { M.x = 3; N.y = 4; };; (* error: different definitions *)
|
||||
^^^
|
||||
Error: The record field N.y belongs to the type N.bar
|
||||
but is mixed here with fields of type M.foo
|
||||
# module MN :
|
||||
module MN :
|
||||
sig
|
||||
type foo = M.foo = { x : int; y : int; }
|
||||
type bar = N.bar = { x : int; y : int; }
|
||||
|
@ -160,7 +159,7 @@ module NM :
|
|||
type bar = N.bar = { x : int; y : int; }
|
||||
type foo = M.foo = { x : int; y : int; }
|
||||
end
|
||||
# Characters 8-28:
|
||||
Characters 8-28:
|
||||
let r = {MN.x = 3; NM.y = 4};; (* error: type would change with order *)
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 41: x belongs to several types: MN.bar MN.foo
|
||||
|
@ -175,12 +174,12 @@ Characters 19-23:
|
|||
^^^^
|
||||
Error: The record field NM.y belongs to the type NM.foo = M.foo
|
||||
but is mixed here with fields of type MN.bar = N.bar
|
||||
# module M :
|
||||
module M :
|
||||
sig
|
||||
type foo = { x : int; y : int; }
|
||||
type bar = { x : int; y : int; z : int; }
|
||||
end
|
||||
# Characters 65-66:
|
||||
Characters 65-66:
|
||||
let f r = ignore (r: foo); {r with x = 2; z = 3}
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -190,13 +189,13 @@ Characters 72-73:
|
|||
^
|
||||
Error: This record expression is expected to have type M.foo
|
||||
The field z does not belong to type M.foo
|
||||
# module M :
|
||||
module M :
|
||||
sig
|
||||
type foo = M.foo = { x : int; y : int; }
|
||||
type bar = M.bar = { x : int; y : int; z : int; }
|
||||
type other = { a : int; b : int; }
|
||||
end
|
||||
# Characters 66-67:
|
||||
Characters 66-67:
|
||||
let f r = ignore (r: foo); { r with x = 3; a = 4 }
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -206,7 +205,7 @@ Characters 73-74:
|
|||
^
|
||||
Error: This record expression is expected to have type M.foo
|
||||
The field a does not belong to type M.foo
|
||||
# Characters 39-40:
|
||||
Characters 39-40:
|
||||
let r = {x=1; y=2}
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -221,30 +220,30 @@ Characters 67-68:
|
|||
^
|
||||
Error: This record expression is expected to have type M.other
|
||||
The field x does not belong to type M.other
|
||||
# module A : sig type t = { x : int; } end
|
||||
module A : sig type t = { x : int; } end
|
||||
module B : sig type t = { x : int; } end
|
||||
# Characters 20-23:
|
||||
Characters 20-23:
|
||||
let f (r : B.t) = r.A.x;; (* fail *)
|
||||
^^^
|
||||
Error: The field A.x belongs to the record type A.t
|
||||
but a field was expected belonging to the record type B.t
|
||||
# Characters 88-91:
|
||||
Characters 88-91:
|
||||
let a : t = {x=1;yyz=2}
|
||||
^^^
|
||||
Error: This record expression is expected to have type t
|
||||
The field yyz does not belong to type t
|
||||
Hint: Did you mean yyy?
|
||||
# type t = A
|
||||
type t = A
|
||||
type s = A
|
||||
class f : t -> object end
|
||||
# Characters 12-13:
|
||||
Characters 12-13:
|
||||
class g = f A;; (* ok *)
|
||||
^
|
||||
Warning 42: this use of A relies on type-directed disambiguation,
|
||||
it will not compile with OCaml 4.00 or earlier.
|
||||
class g : f
|
||||
# class f : 'a -> 'a -> object end
|
||||
# Characters 13-14:
|
||||
class f : 'a -> 'a -> object end
|
||||
Characters 13-14:
|
||||
class g = f (A : t) A;; (* warn with -principal *)
|
||||
^
|
||||
Warning 42: this use of A relies on type-directed disambiguation,
|
||||
|
@ -259,7 +258,7 @@ Characters 20-21:
|
|||
Warning 42: this use of A relies on type-directed disambiguation,
|
||||
it will not compile with OCaml 4.00 or earlier.
|
||||
class g : f
|
||||
# Characters 199-200:
|
||||
Characters 199-200:
|
||||
let y : t = {x = 0}
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -274,7 +273,7 @@ module Shadow1 :
|
|||
module M : sig type s = { x : string; } end
|
||||
val y : t
|
||||
end
|
||||
# Characters 97-103:
|
||||
Characters 97-103:
|
||||
open M (* this open shadows label 'x' *)
|
||||
^^^^^^
|
||||
Warning 45: this open statement shadows the label x (which is later used)
|
||||
|
@ -289,7 +288,7 @@ module Shadow2 :
|
|||
module M : sig type s = { x : string; } end
|
||||
val y : M.s
|
||||
end
|
||||
# Characters 167-170:
|
||||
Characters 167-170:
|
||||
let f (u : u) = match u with `Key {loc} -> loc
|
||||
^^^
|
||||
Warning 42: this use of loc relies on type-directed disambiguation,
|
||||
|
@ -301,7 +300,7 @@ module P6235 :
|
|||
type u = [ `Key of t ]
|
||||
val f : u -> string
|
||||
end
|
||||
# Characters 219-224:
|
||||
Characters 219-224:
|
||||
|`Key {loc} -> loc
|
||||
^^^^^
|
||||
Warning 41: these field labels belong to several types: v t
|
||||
|
@ -318,4 +317,4 @@ Characters 214-224:
|
|||
Error: This pattern matches values of type [? `Key of v ]
|
||||
but a pattern was expected which matches values of type u
|
||||
Types for tag `Key are incompatible
|
||||
#
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
# module M1 :
|
||||
module M1 :
|
||||
sig type t = { x : int; y : int; } type u = { x : bool; y : bool; } end
|
||||
# Characters 49-50:
|
||||
Characters 49-50:
|
||||
let f1 (r:t) = r.x (* ok *)
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -27,7 +26,7 @@ Characters 148-149:
|
|||
Warning 27: unused variable x.
|
||||
module OK :
|
||||
sig val f1 : M1.t -> int val f2 : M1.t -> int val f3 : M1.t -> int end
|
||||
# Characters 55-61:
|
||||
Characters 55-61:
|
||||
let f r = match r with {x; y} -> y + y
|
||||
^^^^^^
|
||||
Warning 41: these field labels belong to several types: M1.u M1.t
|
||||
|
@ -37,7 +36,7 @@ Characters 65-66:
|
|||
^
|
||||
Error: This expression has type bool but an expression was expected of type
|
||||
int
|
||||
# Characters 86-87:
|
||||
Characters 86-87:
|
||||
{x; y} -> y + y
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -52,14 +51,14 @@ Characters 86-87:
|
|||
^
|
||||
Warning 27: unused variable x.
|
||||
module F2 : sig val f : M1.t -> int end
|
||||
# module M : sig type t = { x : int; } type u = { x : bool; } end
|
||||
# Characters 18-21:
|
||||
module M : sig type t = { x : int; } type u = { x : bool; } end
|
||||
Characters 18-21:
|
||||
let f (r:M.t) = r.M.x;; (* ok *)
|
||||
^^^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
it will not compile with OCaml 4.00 or earlier.
|
||||
val f : M.t -> int = <fun>
|
||||
# Characters 18-19:
|
||||
Characters 18-19:
|
||||
let f (r:M.t) = r.x;; (* warning *)
|
||||
^
|
||||
Warning 40: x was selected from type M.t.
|
||||
|
@ -71,7 +70,7 @@ Characters 18-19:
|
|||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
it will not compile with OCaml 4.00 or earlier.
|
||||
val f : M.t -> int = <fun>
|
||||
# Characters 8-9:
|
||||
Characters 8-9:
|
||||
let f ({x}:M.t) = x;; (* warning *)
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -83,9 +82,9 @@ Warning 40: this record of type M.t contains fields that are
|
|||
not visible in the current scope: x.
|
||||
They will not be selected if the type becomes unknown.
|
||||
val f : M.t -> int = <fun>
|
||||
# module M : sig type t = { x : int; y : int; } end
|
||||
# module N : sig type u = { x : bool; y : bool; } end
|
||||
# Characters 57-58:
|
||||
module M : sig type t = { x : int; y : int; } end
|
||||
module N : sig type u = { x : bool; y : bool; } end
|
||||
Characters 57-58:
|
||||
let f (r:M.t) = r.x
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -95,19 +94,19 @@ Characters 30-36:
|
|||
^^^^^^
|
||||
Warning 33: unused open N.
|
||||
module OK : sig val f : M.t -> int end
|
||||
# module M :
|
||||
module M :
|
||||
sig
|
||||
type t = { x : int; }
|
||||
module N : sig type s = t = { x : int; } end
|
||||
type u = { x : bool; }
|
||||
end
|
||||
# module OK : sig val f : M.t -> int end
|
||||
# module M :
|
||||
module OK : sig val f : M.t -> int end
|
||||
module M :
|
||||
sig
|
||||
type u = { x : bool; y : int; z : char; }
|
||||
type t = { x : int; y : bool; }
|
||||
end
|
||||
# Characters 37-38:
|
||||
Characters 37-38:
|
||||
let f {x;z} = x,z
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -119,11 +118,11 @@ Warning 9: the following labels are not bound in this record pattern:
|
|||
y
|
||||
Either bind these labels explicitly or add '; _' to the pattern.
|
||||
module OK : sig val f : M.u -> bool * char end
|
||||
# Characters 38-52:
|
||||
Characters 38-52:
|
||||
let r = {x=true;z='z'}
|
||||
^^^^^^^^^^^^^^
|
||||
Error: Some record fields are undefined: y
|
||||
# Characters 90-91:
|
||||
Characters 90-91:
|
||||
let r = {x=3; y=true}
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -139,19 +138,19 @@ module OK :
|
|||
type t = { x : bool; y : int; z : char; }
|
||||
val r : u
|
||||
end
|
||||
# Characters 111-112:
|
||||
Characters 111-112:
|
||||
let b : bar = {x=3; y=4}
|
||||
^
|
||||
Error: This record expression is expected to have type bar
|
||||
The field y does not belong to type bar
|
||||
# module M : sig type foo = { x : int; y : int; } end
|
||||
# module N : sig type bar = { x : int; y : int; } end
|
||||
# Characters 19-22:
|
||||
module M : sig type foo = { x : int; y : int; } end
|
||||
module N : sig type bar = { x : int; y : int; } end
|
||||
Characters 19-22:
|
||||
let r = { M.x = 3; N.y = 4; };; (* error: different definitions *)
|
||||
^^^
|
||||
Error: The record field N.y belongs to the type N.bar
|
||||
but is mixed here with fields of type M.foo
|
||||
# module MN :
|
||||
module MN :
|
||||
sig
|
||||
type foo = M.foo = { x : int; y : int; }
|
||||
type bar = N.bar = { x : int; y : int; }
|
||||
|
@ -161,7 +160,7 @@ module NM :
|
|||
type bar = N.bar = { x : int; y : int; }
|
||||
type foo = M.foo = { x : int; y : int; }
|
||||
end
|
||||
# Characters 8-28:
|
||||
Characters 8-28:
|
||||
let r = {MN.x = 3; NM.y = 4};; (* error: type would change with order *)
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 41: x belongs to several types: MN.bar MN.foo
|
||||
|
@ -176,12 +175,12 @@ Characters 19-23:
|
|||
^^^^
|
||||
Error: The record field NM.y belongs to the type NM.foo = M.foo
|
||||
but is mixed here with fields of type MN.bar = N.bar
|
||||
# module M :
|
||||
module M :
|
||||
sig
|
||||
type foo = { x : int; y : int; }
|
||||
type bar = { x : int; y : int; z : int; }
|
||||
end
|
||||
# Characters 65-66:
|
||||
Characters 65-66:
|
||||
let f r = ignore (r: foo); {r with x = 2; z = 3}
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -191,13 +190,13 @@ Characters 72-73:
|
|||
^
|
||||
Error: This record expression is expected to have type M.foo
|
||||
The field z does not belong to type M.foo
|
||||
# module M :
|
||||
module M :
|
||||
sig
|
||||
type foo = M.foo = { x : int; y : int; }
|
||||
type bar = M.bar = { x : int; y : int; z : int; }
|
||||
type other = { a : int; b : int; }
|
||||
end
|
||||
# Characters 66-67:
|
||||
Characters 66-67:
|
||||
let f r = ignore (r: foo); { r with x = 3; a = 4 }
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -207,7 +206,7 @@ Characters 73-74:
|
|||
^
|
||||
Error: This record expression is expected to have type M.foo
|
||||
The field a does not belong to type M.foo
|
||||
# Characters 39-40:
|
||||
Characters 39-40:
|
||||
let r = {x=1; y=2}
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -222,30 +221,30 @@ Characters 67-68:
|
|||
^
|
||||
Error: This record expression is expected to have type M.other
|
||||
The field x does not belong to type M.other
|
||||
# module A : sig type t = { x : int; } end
|
||||
module A : sig type t = { x : int; } end
|
||||
module B : sig type t = { x : int; } end
|
||||
# Characters 20-23:
|
||||
Characters 20-23:
|
||||
let f (r : B.t) = r.A.x;; (* fail *)
|
||||
^^^
|
||||
Error: The field A.x belongs to the record type A.t
|
||||
but a field was expected belonging to the record type B.t
|
||||
# Characters 88-91:
|
||||
Characters 88-91:
|
||||
let a : t = {x=1;yyz=2}
|
||||
^^^
|
||||
Error: This record expression is expected to have type t
|
||||
The field yyz does not belong to type t
|
||||
Hint: Did you mean yyy?
|
||||
# type t = A
|
||||
type t = A
|
||||
type s = A
|
||||
class f : t -> object end
|
||||
# Characters 12-13:
|
||||
Characters 12-13:
|
||||
class g = f A;; (* ok *)
|
||||
^
|
||||
Warning 42: this use of A relies on type-directed disambiguation,
|
||||
it will not compile with OCaml 4.00 or earlier.
|
||||
class g : f
|
||||
# class f : 'a -> 'a -> object end
|
||||
# Characters 13-14:
|
||||
class f : 'a -> 'a -> object end
|
||||
Characters 13-14:
|
||||
class g = f (A : t) A;; (* warn with -principal *)
|
||||
^
|
||||
Warning 42: this use of A relies on type-directed disambiguation,
|
||||
|
@ -256,7 +255,7 @@ Characters 20-21:
|
|||
Warning 42: this use of A relies on type-directed disambiguation,
|
||||
it will not compile with OCaml 4.00 or earlier.
|
||||
class g : f
|
||||
# Characters 199-200:
|
||||
Characters 199-200:
|
||||
let y : t = {x = 0}
|
||||
^
|
||||
Warning 42: this use of x relies on type-directed disambiguation,
|
||||
|
@ -271,7 +270,7 @@ module Shadow1 :
|
|||
module M : sig type s = { x : string; } end
|
||||
val y : t
|
||||
end
|
||||
# Characters 97-103:
|
||||
Characters 97-103:
|
||||
open M (* this open shadows label 'x' *)
|
||||
^^^^^^
|
||||
Warning 45: this open statement shadows the label x (which is later used)
|
||||
|
@ -286,7 +285,7 @@ module Shadow2 :
|
|||
module M : sig type s = { x : string; } end
|
||||
val y : M.s
|
||||
end
|
||||
# Characters 167-170:
|
||||
Characters 167-170:
|
||||
let f (u : u) = match u with `Key {loc} -> loc
|
||||
^^^
|
||||
Warning 42: this use of loc relies on type-directed disambiguation,
|
||||
|
@ -298,7 +297,7 @@ module P6235 :
|
|||
type u = [ `Key of t ]
|
||||
val f : u -> string
|
||||
end
|
||||
# Characters 220-223:
|
||||
Characters 220-223:
|
||||
|`Key {loc} -> loc
|
||||
^^^
|
||||
Warning 42: this use of loc relies on type-directed disambiguation,
|
||||
|
@ -310,4 +309,4 @@ module P6235' :
|
|||
type u = [ `Key of t ]
|
||||
val f : u -> string
|
||||
end
|
||||
#
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
(* TEST
|
||||
flags = " -w A -strict-sequence "
|
||||
* toplevel
|
||||
* toplevel with principal
|
||||
*)
|
||||
|
||||
(* Use type information *)
|
||||
module M1 = struct
|
||||
type t = {x: int; y: int}
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
|
||||
# Characters 35-52:
|
||||
Characters 98-115:
|
||||
type unused = int
|
||||
^^^^^^^^^^^^^^^^^
|
||||
Warning 34: unused type unused.
|
||||
module Unused : sig end
|
||||
# Characters 68-93:
|
||||
Characters 68-93:
|
||||
type nonrec unused = used
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 34: unused type unused.
|
||||
module Unused_nonrec : sig end
|
||||
# Characters 40-65:
|
||||
Characters 40-65:
|
||||
type unused = A of unused
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 34: unused type unused.
|
||||
|
@ -18,41 +17,41 @@ Characters 40-65:
|
|||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 37: unused constructor A.
|
||||
module Unused_rec : sig end
|
||||
# Characters 46-70:
|
||||
Characters 46-70:
|
||||
exception Nobody_uses_me
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 38: unused exception Nobody_uses_me
|
||||
module Unused_exception : sig end
|
||||
# Characters 96-110:
|
||||
Characters 96-110:
|
||||
type t += Nobody_uses_me
|
||||
^^^^^^^^^^^^^^
|
||||
Warning 38: unused extension constructor Nobody_uses_me
|
||||
module Unused_extension_constructor : sig type t = .. end
|
||||
# Characters 91-121:
|
||||
Characters 91-121:
|
||||
exception Nobody_constructs_me
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 38: exception Nobody_constructs_me is never used to build values.
|
||||
(However, this constructor appears in patterns.)
|
||||
module Unused_exception_outside_patterns : sig val falsity : exn -> bool end
|
||||
# Characters 127-147:
|
||||
Characters 127-147:
|
||||
type t += Nobody_constructs_me
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 38: extension constructor Nobody_constructs_me is never used to build values.
|
||||
(However, this constructor appears in patterns.)
|
||||
module Unused_extension_outside_patterns :
|
||||
sig type t = .. val falsity : t -> bool end
|
||||
# Characters 88-109:
|
||||
Characters 88-109:
|
||||
exception Private_exn
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
Warning 38: exception Private_exn is never used to build values.
|
||||
It is exported or rebound as a private extension.
|
||||
module Unused_private_exception : sig type exn += private Private_exn end
|
||||
# Characters 124-135:
|
||||
Characters 124-135:
|
||||
type t += Private_ext
|
||||
^^^^^^^^^^^
|
||||
Warning 38: extension constructor Private_ext is never used to build values.
|
||||
It is exported or rebound as a private extension.
|
||||
module Unused_private_extension :
|
||||
sig type t = .. type t += private Private_ext end
|
||||
# module Pr7438 : sig end
|
||||
#
|
||||
module Pr7438 : sig end
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
(* TEST
|
||||
flags = " -w A -strict-sequence "
|
||||
* toplevel
|
||||
*)
|
||||
|
||||
module Unused : sig
|
||||
end = struct
|
||||
type unused = int
|
||||
|
|
Loading…
Reference in New Issue