+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)
---------------------------
-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
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>.
#
# 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'
# 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]...
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
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.
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 $@
-{ $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
-VERSION=4.11.0
+VERSION=4.11.1
# Note: This is present for the flexdll bootstrap where it exposed as the old
*) :
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" ;; #(
*) :
ocamldoc=ocamldoc
fi
-case $enable_ocamltest,4.11.0 in #(
+case $enable_ocamltest,4.11.1 in #(
yes,*|,*+dev*) :
ocamltest='ocamltest' ;; #(
*) :
# 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
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\\"
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}
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>
+|}]
'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
+|}]
(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
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 =