New upstream version 4.11.1
authorStephane Glondu <steph@glondu.net>
Thu, 3 Sep 2020 12:52:56 +0000 (14:52 +0200)
committerStéphane Glondu <glondu@debian.org>
Thu, 3 Sep 2020 12:52:56 +0000 (14:52 +0200)
Changes
VERSION
boot/ocamlc
boot/ocamllex
configure
ocaml-variants.opam
testsuite/tests/typing-misc/labels.ml
testsuite/tests/typing-poly/poly.ml
typing/ctype.ml
typing/typecore.ml

diff --git a/Changes b/Changes
index f4354afe04d83e2181c6a51a5a5e9c3e263e86da..62e58bd58a5b0f2cda656078dea0412421b8a4c9 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,16 @@
+OCaml 4.11.1 (31 August 2020)
+-----------------------------
+
+### Bug fixes:
+
+- #9856, #9857: Prevent polymorphic type annotations from generalizing
+  weak polymorphic variables.
+  (Leo White, review by Jacques Garrigue)
+
+- #9859, #9862: Remove an erroneous assertion when inferred function types
+  appear in the right hand side of an explicit :> coercion
+  (Florian Angeletti, review by Thomas Refis)
+
 OCaml 4.11.0 (19 August 2020)
 ---------------------------
 
diff --git a/VERSION b/VERSION
index eeef3d9a6590bdff40f5794d75f6152244d607a9..ec07a3e6a62cb6d88f963be072e8bb51ed7cfcb8 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
-4.11.0
+4.11.1
 
 # The version string is the first line of this file.
 # It must be in the format described in stdlib/sys.mli
index 13606009a5b305f49f9d11b4eba631faa4444874..8a4f068132adbf6c76a92709729a7d7e43b7694a 100755 (executable)
Binary files a/boot/ocamlc and b/boot/ocamlc differ
index c09dc74cd1a771ba718ddfd30b798675d7d8b5e8..930676103aab5d3ff3010901d7d3041663c4f372 100755 (executable)
Binary files a/boot/ocamllex and b/boot/ocamllex differ
index b6c44d22d45aca9162f24351503ec76662fdcc56..74657d2d9a58f6921fab4e7ccfe050cc474391a4 100755 (executable)
--- a/configure
+++ b/configure
@@ -56,7 +56,7 @@ if test -e '.git' ; then :
   fi
 fi
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for OCaml 4.11.0.
+# Generated by GNU Autoconf 2.69 for OCaml 4.11.1.
 #
 # Report bugs to <caml-list@inria.fr>.
 #
@@ -646,8 +646,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='OCaml'
 PACKAGE_TARNAME='ocaml'
-PACKAGE_VERSION='4.11.0'
-PACKAGE_STRING='OCaml 4.11.0'
+PACKAGE_VERSION='4.11.1'
+PACKAGE_STRING='OCaml 4.11.1'
 PACKAGE_BUGREPORT='caml-list@inria.fr'
 PACKAGE_URL='http://www.ocaml.org'
 
@@ -1482,7 +1482,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures OCaml 4.11.0 to adapt to many kinds of systems.
+\`configure' configures OCaml 4.11.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1548,7 +1548,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of OCaml 4.11.0:";;
+     short | recursive ) echo "Configuration of OCaml 4.11.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1711,7 +1711,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-OCaml configure 4.11.0
+OCaml configure 4.11.1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2374,7 +2374,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by OCaml $as_me 4.11.0, which was
+It was created by OCaml $as_me 4.11.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2723,8 +2723,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring OCaml version 4.11.0" >&5
-$as_echo "$as_me: Configuring OCaml version 4.11.0" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring OCaml version 4.11.1" >&5
+$as_echo "$as_me: Configuring OCaml version 4.11.1" >&6;}
 
 # Configuration variables
 
@@ -2800,7 +2800,7 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 
 
 
-VERSION=4.11.0
+VERSION=4.11.1
 
 
 # Note: This is present for the flexdll bootstrap where it exposed as the old
@@ -12475,7 +12475,7 @@ case $ocaml_cv_cc_vendor in #(
   *) :
     outputobj='-o $(EMPTY)'
   gcc_warnings='-Wall -Wdeclaration-after-statement'
-  case 4.11.0 in #(
+  case 4.11.1 in #(
   *+dev*) :
     gcc_warnings="$gcc_warnings -Werror" ;; #(
   *) :
@@ -16893,7 +16893,7 @@ else
   ocamldoc=ocamldoc
 fi
 
-case $enable_ocamltest,4.11.0 in #(
+case $enable_ocamltest,4.11.1 in #(
   yes,*|,*+dev*) :
     ocamltest='ocamltest' ;; #(
   *) :
@@ -17610,7 +17610,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by OCaml $as_me 4.11.0, which was
+This file was extended by OCaml $as_me 4.11.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -17677,7 +17677,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-OCaml config.status 4.11.0
+OCaml config.status 4.11.1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index 693432ea709899680619c86064faa1ae41515e33..f6b0abc80f953c18d744e3b1bd64d1f3f599cd6a 100644 (file)
@@ -1,8 +1,8 @@
 opam-version: "2.0"
-version: "4.11.0"
-synopsis: "OCaml development version"
+version: "4.11.1"
+synopsis: "OCaml 4.11.1, official release"
 depends: [
-  "ocaml" {= "4.11.0" & post}
+  "ocaml" {= "4.11.1" & post}
   "base-unix" {post}
   "base-bigarray" {post}
   "base-threads" {post}
index 5192f4114a9405400b0e3f7d3ec0d3c25cdad47a..62e1c07ba77fb7c7523682df6a86771c89670972 100644 (file)
@@ -90,3 +90,32 @@ Line 1, characters 45-46:
 Warning 19: commuted an argument without principality.
 val f : (x:int -> unit -> int) -> x:int -> int = <fun>
 |}];;
+
+(* 9859: inferred function types may appear in the right hand side of :> *)
+class setup = object
+  method with_ f = (f 0:unit)
+end
+class virtual fail = object (self)
+  method trigger = (self :> setup )
+end
+[%%expect {|
+class setup : object method with_ : (int -> unit) -> unit end
+class virtual fail :
+  object
+    method trigger : setup
+    method virtual with_ : (int -> unit) -> unit
+  end
+|}]
+
+module type T = sig type t  end
+let type_of (type x) (x: x) = (module struct type t = x end: T with type t = x)
+let f g = 1 + g ~x:0 ~y:0;;
+module E = (val type_of f)
+let g = ( (fun _ -> f) :> 'a -> E.t)
+[%%expect {|
+module type T = sig type t end
+val type_of : 'x -> (module T with type t = 'x) = <fun>
+val f : (x:int -> y:int -> int) -> int = <fun>
+module E : sig type t = (x:int -> y:int -> int) -> int end
+val g : 'a -> E.t = <fun>
+|}]
index 88930a5901746a3b5807d5b3b9aa7f64d6720faa..655a1ee98a6733efa349145b41385621ad05f39e 100644 (file)
@@ -1852,3 +1852,27 @@ Error: This expression has type < x : 'b. 'b s list >
        'a list
        The universal variable 'b would escape its scope
 |}]
+
+(* #9856 *)
+let f x =
+  let ref : type a . a option ref = ref None in
+  ref := Some x;
+  Option.get !ref
+[%%expect{|
+Line 2, characters 6-44:
+2 |   let ref : type a . a option ref = ref None in
+          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type 'a option ref which is less general than
+         'a0. 'a0 option ref
+|}]
+
+type pr = { foo : 'a. 'a option ref }
+let x = { foo = ref None }
+[%%expect{|
+type pr = { foo : 'a. 'a option ref; }
+Line 2, characters 16-24:
+2 | let x = { foo = ref None }
+                    ^^^^^^^^
+Error: This field value has type 'b option ref which is less general than
+         'a. 'a option ref
+|}]
index 103309768b462fb3293549a8dc4b391835870296..826b048a546430189ff05fffd0cd558266700c6b 100644 (file)
@@ -3999,8 +3999,7 @@ let rec build_subtype env visited loops posi level t =
           (t, Unchanged)
       else
         (t, Unchanged)
-  | Tarrow(l, t1, t2, com) ->
-      assert (com = Cok);
+  | Tarrow(l, t1, t2, _) ->
       if memq_warn t visited then (t, Unchanged) else
       let visited = t :: visited in
       let (t1', c1) = build_subtype env visited loops (not posi) level t1 in
index 995ee91a4b1038b0a5ca2cccac2c4ac9c5374234..4b2ce97cbc3dfa406889c412f3f0e79d84663c8d 100644 (file)
@@ -4978,7 +4978,9 @@ and type_let
             so we do it anyway. *)
          generalize exp.exp_type
        | Some vars ->
-         generalize_and_check_univars env "definition" exp pat.pat_type vars)
+           if maybe_expansive exp then
+             lower_contravariant env exp.exp_type;
+           generalize_and_check_univars env "definition" exp pat.pat_type vars)
     pat_list exp_list;
   let l = List.combine pat_list exp_list in
   let l =