diff options
Diffstat (limited to 'testsuite/tests/typing-warnings')
22 files changed, 106 insertions, 55 deletions
diff --git a/testsuite/tests/typing-warnings/ambiguous_guarded_disjunction.ml b/testsuite/tests/typing-warnings/ambiguous_guarded_disjunction.ml index 0250841e91..eff6a73aec 100644 --- a/testsuite/tests/typing-warnings/ambiguous_guarded_disjunction.ml +++ b/testsuite/tests/typing-warnings/ambiguous_guarded_disjunction.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A -strict-sequence " - * expect + flags = " -w +A -strict-sequence "; + expect; *) (* Ignore OCAMLRUNPARAM=b to be reproducible *) @@ -30,7 +30,7 @@ Line 2, characters 4-29: Warning 57 [ambiguous-var-in-pattern-guard]: Ambiguous or-pattern variables under guard; variable x appears in different places in different or-pattern alternatives. Only the first match will be used to evaluate the guard expression. -(See manual section 13.5) +(see manual section 13.5.4) val ambiguous_typical_example : expr * expr -> unit = <fun> |}] @@ -100,7 +100,7 @@ Line 2, characters 4-43: Warning 57 [ambiguous-var-in-pattern-guard]: Ambiguous or-pattern variables under guard; variable y appears in different places in different or-pattern alternatives. Only the first match will be used to evaluate the guard expression. -(See manual section 13.5) +(see manual section 13.5.4) val ambiguous__y : [> `B of 'a * bool option * bool option ] -> unit = <fun> |}] @@ -134,7 +134,7 @@ Line 2, characters 4-43: Warning 57 [ambiguous-var-in-pattern-guard]: Ambiguous or-pattern variables under guard; variable y appears in different places in different or-pattern alternatives. Only the first match will be used to evaluate the guard expression. -(See manual section 13.5) +(see manual section 13.5.4) val ambiguous__x_y : [> `B of 'a * 'a option * 'a option ] -> unit = <fun> |}] @@ -150,7 +150,7 @@ Line 2, characters 4-43: Warning 57 [ambiguous-var-in-pattern-guard]: Ambiguous or-pattern variables under guard; variables y, z appear in different places in different or-pattern alternatives. Only the first match will be used to evaluate the guard expression. -(See manual section 13.5) +(see manual section 13.5.4) val ambiguous__x_y_z : [> `B of 'a * 'a option * 'a option ] -> unit = <fun> |}] @@ -184,7 +184,7 @@ Line 2, characters 4-40: Warning 57 [ambiguous-var-in-pattern-guard]: Ambiguous or-pattern variables under guard; variable x appears in different places in different or-pattern alternatives. Only the first match will be used to evaluate the guard expression. -(See manual section 13.5) +(see manual section 13.5.4) val ambiguous__in_depth : [> `A of [> `B of bool option * bool option ] ] -> unit = <fun> @@ -218,7 +218,7 @@ Lines 2-3, characters 4-58: Warning 57 [ambiguous-var-in-pattern-guard]: Ambiguous or-pattern variables under guard; variable x appears in different places in different or-pattern alternatives. Only the first match will be used to evaluate the guard expression. -(See manual section 13.5) +(see manual section 13.5.4) val ambiguous__first_orpat : [> `A of @@ -239,7 +239,7 @@ Lines 2-3, characters 4-42: Warning 57 [ambiguous-var-in-pattern-guard]: Ambiguous or-pattern variables under guard; variable y appears in different places in different or-pattern alternatives. Only the first match will be used to evaluate the guard expression. -(See manual section 13.5) +(see manual section 13.5.4) val ambiguous__second_orpat : [> `A of @@ -335,7 +335,7 @@ Lines 2-3, characters 2-17: Warning 57 [ambiguous-var-in-pattern-guard]: Ambiguous or-pattern variables under guard; variables x, y appear in different places in different or-pattern alternatives. Only the first match will be used to evaluate the guard expression. -(See manual section 13.5) +(see manual section 13.5.4) val ambiguous__amoi : amoi -> int = <fun> |}] @@ -358,7 +358,7 @@ Lines 2-3, characters 4-24: Warning 57 [ambiguous-var-in-pattern-guard]: Ambiguous or-pattern variables under guard; variable M appears in different places in different or-pattern alternatives. Only the first match will be used to evaluate the guard expression. -(See manual section 13.5) +(see manual section 13.5.4) val ambiguous__module_variable : (module S) * (module S) * (int * int) -> bool -> int = <fun> @@ -411,7 +411,7 @@ Line 2, characters 4-56: Warning 57 [ambiguous-var-in-pattern-guard]: Ambiguous or-pattern variables under guard; variables x, y appear in different places in different or-pattern alternatives. Only the first match will be used to evaluate the guard expression. -(See manual section 13.5) +(see manual section 13.5.4) val ambiguous_xy_but_not_ambiguous_z : (int -> int -> bool) -> t2 -> int = <fun> @@ -447,7 +447,7 @@ Line 2, characters 4-56: Warning 57 [ambiguous-var-in-pattern-guard]: Ambiguous or-pattern variables under guard; variables x, y appear in different places in different or-pattern alternatives. Only the first match will be used to evaluate the guard expression. -(See manual section 13.5) +(see manual section 13.5.4) val ambiguous_xy_but_not_ambiguous_z : (int -> int -> bool) -> t2 -> int = <fun> @@ -509,7 +509,7 @@ Line 3, characters 4-29: Warning 57 [ambiguous-var-in-pattern-guard]: Ambiguous or-pattern variables under guard; variable y appears in different places in different or-pattern alternatives. Only the first match will be used to evaluate the guard expression. -(See manual section 13.5) +(see manual section 13.5.4) val guarded_ambiguity : expr * expr -> unit = <fun> |}] @@ -541,7 +541,7 @@ Line 4, characters 4-29: Warning 57 [ambiguous-var-in-pattern-guard]: Ambiguous or-pattern variables under guard; variable x appears in different places in different or-pattern alternatives. Only the first match will be used to evaluate the guard expression. -(See manual section 13.5) +(see manual section 13.5.4) val cmp : (a -> bool) -> a alg -> a alg -> unit = <fun> |}] diff --git a/testsuite/tests/typing-warnings/application.ml b/testsuite/tests/typing-warnings/application.ml index 04883f44e5..8ad444b079 100644 --- a/testsuite/tests/typing-warnings/application.ml +++ b/testsuite/tests/typing-warnings/application.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A -strict-sequence " - * expect + flags = " -w +A -strict-sequence "; + expect; *) (* Ignore OCAMLRUNPARAM=b to be reproducible *) @@ -79,6 +79,52 @@ maybe some arguments are missing. val f : t -> unit = <fun> |}] +let f a b = a + b;; +match f 42 with +| _ -> ();; +[%%expect {| +val f : int -> int -> int = <fun> +Line 2, characters 6-10: +2 | match f 42 with + ^^^^ +Warning 5 [ignored-partial-application]: this function application is partial, +maybe some arguments are missing. + +- : unit = () +|}] + +let f a b = a + b;; +match f 42 with +| _ -> () +| exception _ -> ();; +[%%expect {| +val f : int -> int -> int = <fun> +Line 2, characters 6-10: +2 | match f 42 with + ^^^^ +Warning 5 [ignored-partial-application]: this function application is partial, +maybe some arguments are missing. + +- : unit = () +|}] + +let f a b = a + b;; +match f 42 with +| x -> ignore (x 34);; +[%%expect {| +val f : int -> int -> int = <fun> +- : unit = () +|}] + + +let f a b = a + b;; +match (f 42 : _) with +| _ -> ();; +[%%expect {| +val f : int -> int -> int = <fun> +- : unit = () +|}] + let _ = raise Exit 3;; [%%expect {| Line 1, characters 19-20: diff --git a/testsuite/tests/typing-warnings/coercions.ml b/testsuite/tests/typing-warnings/coercions.ml index 4c96caa4ed..874dd35d71 100644 --- a/testsuite/tests/typing-warnings/coercions.ml +++ b/testsuite/tests/typing-warnings/coercions.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A -strict-sequence " - * expect + flags = " -w +A -strict-sequence "; + expect; *) (* comment 9644 of PR#6000 *) diff --git a/testsuite/tests/typing-warnings/disable_warnings_classes.ml b/testsuite/tests/typing-warnings/disable_warnings_classes.ml index 79f1f4b686..cd502a9b1a 100644 --- a/testsuite/tests/typing-warnings/disable_warnings_classes.ml +++ b/testsuite/tests/typing-warnings/disable_warnings_classes.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A " - * expect + flags = " -w +A "; + expect; *) class c = object diff --git a/testsuite/tests/typing-warnings/exhaustiveness.ml b/testsuite/tests/typing-warnings/exhaustiveness.ml index 62add57930..702ab1e51c 100644 --- a/testsuite/tests/typing-warnings/exhaustiveness.ml +++ b/testsuite/tests/typing-warnings/exhaustiveness.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A -strict-sequence " - * expect + flags = " -w +A -strict-sequence "; + expect; *) let f = function diff --git a/testsuite/tests/typing-warnings/never_returns.ml b/testsuite/tests/typing-warnings/never_returns.ml index fac31d9dd3..b12b4da71a 100644 --- a/testsuite/tests/typing-warnings/never_returns.ml +++ b/testsuite/tests/typing-warnings/never_returns.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w -a+21 " - * expect + flags = " -w -a+21 "; + expect; *) let () = (let module L = List in raise Exit); () ;; diff --git a/testsuite/tests/typing-warnings/open_warnings.ml b/testsuite/tests/typing-warnings/open_warnings.ml index de810ae106..9e4f33817e 100644 --- a/testsuite/tests/typing-warnings/open_warnings.ml +++ b/testsuite/tests/typing-warnings/open_warnings.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A-41-42-18" - * expect + flags = " -w +A-41-42-18"; + expect; *) module T1 : sig end = struct module M = struct type t end (* unused type t *) diff --git a/testsuite/tests/typing-warnings/pr5892.ml b/testsuite/tests/typing-warnings/pr5892.ml index 08939c033f..c1cdd26d8b 100644 --- a/testsuite/tests/typing-warnings/pr5892.ml +++ b/testsuite/tests/typing-warnings/pr5892.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A -strict-sequence " - * expect + flags = " -w +A -strict-sequence "; + expect; *) open CamlinternalOO;; diff --git a/testsuite/tests/typing-warnings/pr6587.ml b/testsuite/tests/typing-warnings/pr6587.ml index 36b9044718..ba4b14ea1e 100644 --- a/testsuite/tests/typing-warnings/pr6587.ml +++ b/testsuite/tests/typing-warnings/pr6587.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A -strict-sequence " - * expect + flags = " -w +A -strict-sequence "; + expect; *) diff --git a/testsuite/tests/typing-warnings/pr6872.ml b/testsuite/tests/typing-warnings/pr6872.ml index 0fbf076da6..b3d8b803a9 100644 --- a/testsuite/tests/typing-warnings/pr6872.ml +++ b/testsuite/tests/typing-warnings/pr6872.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A -strict-sequence " - * expect + flags = " -w +A -strict-sequence "; + expect; *) (* Ignore OCAMLRUNPARAM=b to be reproducible *) diff --git a/testsuite/tests/typing-warnings/pr7085.ml b/testsuite/tests/typing-warnings/pr7085.ml index c286f154f2..25560ad82e 100644 --- a/testsuite/tests/typing-warnings/pr7085.ml +++ b/testsuite/tests/typing-warnings/pr7085.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A -strict-sequence " - * expect + flags = " -w +A -strict-sequence "; + expect; *) module TypEq = struct diff --git a/testsuite/tests/typing-warnings/pr7115.ml b/testsuite/tests/typing-warnings/pr7115.ml index c1e5bef11a..64b1b37735 100644 --- a/testsuite/tests/typing-warnings/pr7115.ml +++ b/testsuite/tests/typing-warnings/pr7115.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A -strict-sequence " - * expect + flags = " -w +A -strict-sequence "; + expect; *) type t = A : t;; diff --git a/testsuite/tests/typing-warnings/pr7261.ml b/testsuite/tests/typing-warnings/pr7261.ml index 65c44ecf17..f032cff317 100644 --- a/testsuite/tests/typing-warnings/pr7261.ml +++ b/testsuite/tests/typing-warnings/pr7261.ml @@ -1,9 +1,14 @@ -(* TEST - flags = " -w +A -strict-sequence " - * toplevel +(* TEST_BELOW +(* Blank lines added here to preserve locations. *) + *) type foo = Foo: [> `Bla ] as 'b ) * 'b -> foo;; type foo = Foo: 'b * 'b -> foo constraint 'b = [> `Bla ];; + +(* TEST + flags = " -w +A -strict-sequence "; + toplevel; +*) diff --git a/testsuite/tests/typing-warnings/pr7297.ml b/testsuite/tests/typing-warnings/pr7297.ml index 572bdb2c95..3d4d724463 100644 --- a/testsuite/tests/typing-warnings/pr7297.ml +++ b/testsuite/tests/typing-warnings/pr7297.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A -strict-sequence " - * expect + flags = " -w +A -strict-sequence "; + expect; *) (* Ignore OCAMLRUNPARAM=b to be reproducible *) diff --git a/testsuite/tests/typing-warnings/pr7553.ml b/testsuite/tests/typing-warnings/pr7553.ml index ef57b0ee7b..25defbed8b 100644 --- a/testsuite/tests/typing-warnings/pr7553.ml +++ b/testsuite/tests/typing-warnings/pr7553.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A -strict-sequence " - * expect + flags = " -w +A -strict-sequence "; + expect; *) module A = struct type foo end;; diff --git a/testsuite/tests/typing-warnings/pr9244.ml b/testsuite/tests/typing-warnings/pr9244.ml index 8fb319707e..282123cd33 100644 --- a/testsuite/tests/typing-warnings/pr9244.ml +++ b/testsuite/tests/typing-warnings/pr9244.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A " - * expect + flags = " -w +A "; + expect; *) module type U = sig end diff --git a/testsuite/tests/typing-warnings/records.ml b/testsuite/tests/typing-warnings/records.ml index 5079418d76..afb2e34bbe 100644 --- a/testsuite/tests/typing-warnings/records.ml +++ b/testsuite/tests/typing-warnings/records.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A -strict-sequence " - * expect + flags = " -w +A -strict-sequence "; + expect; *) (* Use type information *) diff --git a/testsuite/tests/typing-warnings/unused_functor_parameter.ml b/testsuite/tests/typing-warnings/unused_functor_parameter.ml index d14ec34aaa..a0905b0db8 100644 --- a/testsuite/tests/typing-warnings/unused_functor_parameter.ml +++ b/testsuite/tests/typing-warnings/unused_functor_parameter.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A " - * expect + flags = " -w +A "; + expect; *) module Foo(Unused : sig end) = struct end;; diff --git a/testsuite/tests/typing-warnings/unused_rec.ml b/testsuite/tests/typing-warnings/unused_rec.ml index 3f38f848aa..7e5bc66dc7 100644 --- a/testsuite/tests/typing-warnings/unused_rec.ml +++ b/testsuite/tests/typing-warnings/unused_rec.ml @@ -1,5 +1,5 @@ (* TEST - * expect + expect; *) [@@@ocaml.warning "+39"] diff --git a/testsuite/tests/typing-warnings/unused_recmodule.ml b/testsuite/tests/typing-warnings/unused_recmodule.ml index 46c68e8a21..8ee636b538 100644 --- a/testsuite/tests/typing-warnings/unused_recmodule.ml +++ b/testsuite/tests/typing-warnings/unused_recmodule.ml @@ -1,5 +1,5 @@ (* TEST - * expect + expect; *) [@@@ocaml.warning "+a"] diff --git a/testsuite/tests/typing-warnings/unused_types.ml b/testsuite/tests/typing-warnings/unused_types.ml index 66d18f1a57..c000d27bb1 100644 --- a/testsuite/tests/typing-warnings/unused_types.ml +++ b/testsuite/tests/typing-warnings/unused_types.ml @@ -1,6 +1,6 @@ (* TEST - flags = " -w +A -strict-sequence " - * expect + flags = " -w +A -strict-sequence "; + expect; *) module Unused : sig diff --git a/testsuite/tests/typing-warnings/warning16.ml b/testsuite/tests/typing-warnings/warning16.ml index a4ee983973..0cfa2974cc 100644 --- a/testsuite/tests/typing-warnings/warning16.ml +++ b/testsuite/tests/typing-warnings/warning16.ml @@ -1,5 +1,5 @@ (* TEST - * expect + expect; *) let foo ?x = () [%%expect{| |