- PR#5057: fatal typing error with local module + functor + polymorphic variant
- Wrong type for Obj.add_offset.
- Small problem with the representation of Int32, Int64, and Nativeint constants.
+- Use RTLD_LOCAL for native dynlink in private mode.
Objective Caml 3.11.2:
----------------------
* First public release.
-$Id: Changes 10566 2010-06-16 01:32:26Z garrigue $
+$Id: Changes 10613 2010-07-02 08:44:04Z frisch $
./build/fastworld.sh
+If it doesn't work, just use one of the make-based procedures described
+above.
+
6- You can now install the Objective Caml system. This will create the
following commands (in the binary directory selected during
autoconfiguration):
# #
#########################################################################
-# $Id: Makefile.nt 10472 2010-05-28 11:21:46Z garrigue $
+# $Id: Makefile.nt 10616 2010-07-06 10:02:53Z doligez $
# The main Makefile
# Camlp4
camlp4out: ocamlc otherlibraries ocamlbuild-mixed-boot ocamlbuild.byte
- OCAMLBUILD_FIND=/usr/bin/find ./build/camlp4-byte-only.sh
+ ./build/camlp4-byte-only.sh
camlp4opt: ocamlopt otherlibrariesopt ocamlbuild-mixed-boot ocamlbuild.native
- OCAMLBUILD_FIND=/usr/bin/find ./build/camlp4-native-only.sh
+ ./build/camlp4-native-only.sh
# Ocamlbuild
ocamlbuild.byte: ocamlc otherlibraries ocamlbuild-mixed-boot
- OCAMLBUILD_FIND=/usr/bin/find ./build/ocamlbuild-byte-only.sh
+ ./build/ocamlbuild-byte-only.sh
ocamlbuild.native: ocamlopt otherlibrariesopt ocamlbuild-mixed-boot
- OCAMLBUILD_FIND=/usr/bin/find ./build/ocamlbuild-native-only.sh
+ ./build/ocamlbuild-native-only.sh
ocamlbuildlib.native: ocamlopt otherlibrariesopt ocamlbuild-mixed-boot
- OCAMLBUILD_FIND=/usr/bin/find ./build/ocamlbuildlib-native-only.sh
+ ./build/ocamlbuildlib-native-only.sh
.PHONY: ocamlbuild-mixed-boot
ocamlbuild-mixed-boot:
- OCAMLBUILD_FIND=/usr/bin/find ./build/mixed-boot.sh
+ ./build/mixed-boot.sh
partialclean::
rm -rf _build
to adjust the paths accordingly.
Open a Windows Command Prompt and enter the following commands:
- cd "C:\Program Files\Visual Studio 9.0\VC\bin"
+ cd "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin"
vcvars32
echo VCPATH="`cygpath -p '%Path%'`" >C:\cygwin\tmp\msenv
echo LIB="%LIB%;C:\Tcl\lib" >>C:\cygwin\tmp\msenv
echo LIBPATH="%LIBPATH%" >>C:\cygwin\tmp\msenv
echo INCLUDE="%INCLUDE%;C:\Tcl\include" >>C:\cygwin\tmp\msenv
echo FLPATH="`cygpath 'C:\Program Files\flexdll'`" >>C:\cygwin\tmp\msenv
+ echo PATH="${VCPATH}:$PATH:${FLPATH}" >>C:\cygwin\tmp\msenv
+ echo export PATH LIB LIBPATH INCLUDE >>C:\cygwin\tmp\msenv
+ echo export OCAMLBUILD_FIND=/usr/bin/find >>C:\cygwin\tmp\msenv
Open a Cygwin shell and enter the following commands:
tr -d '\r' </tmp/msenv >.msenv
echo '. $HOME/.msenv' >>.bashrc
- echo 'PATH="${VCPATH}:$PATH:${FLPATH}"' >>.bashrc
- echo 'export PATH LIB LIBPATH INCLUDE' >>.bashrc
Now, close the Command Prompt and the shell and you're set up for
using the MS tools under Cygwin.
Instead, use the version of MinGW provided by Cygwin.
Start a Cygwin shell and unpack the source distribution
-(ocaml-X.YZ.tar.gz) with "tar xzf". Change to the top-level
+(ocaml-X.YY.Z.tar.gz) with "tar xzf". Change to the top-level
directory of the OCaml distribution. Then, do
cp config/m-nt.h config/m.h
-3.12.0+beta1
+3.12.0+rc1
# The version string is the first line of this file.
# It must be in the format described in stdlib/sys.mli
-# $Id: VERSION 10582 2010-06-16 11:24:09Z doligez $
+# $Id: VERSION 10630 2010-07-23 15:31:56Z doligez $
/* */
/***********************************************************************/
-/* $Id: unix.c 9153 2008-12-03 18:09:09Z doligez $ */
+/* $Id: unix.c 10613 2010-07-02 08:44:04Z frisch $ */
/* Unix-specific stuff */
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif
+#ifndef RTLD_LOCAL
+#define RTLD_LOCAL 0
+#endif
#ifndef RTLD_NODELETE
#define RTLD_NODELETE 0
#endif
void * caml_dlopen(char * libname, int for_execution, int global)
{
- return dlopen(libname, RTLD_NOW | (global ? RTLD_GLOBAL : 0) | RTLD_NODELETE);
+ return dlopen(libname, RTLD_NOW | (global ? RTLD_GLOBAL : RTLD_LOCAL) | RTLD_NODELETE);
/* Could use RTLD_LAZY if for_execution == 0, but needs testing */
}
# #
#########################################################################
-# $Id: Makefile.msvc 10461 2010-05-25 10:00:39Z frisch $
+# $Id: Makefile.msvc 10622 2010-07-07 12:04:32Z frisch $
# Configuration for Windows, Visual C++ compiler
FLEXDIR=$(shell $(FLEXLINK) -where)
IFLEXDIR=-I"$(FLEXDIR)"
MKDLL=$(FLEXLINK)
-MKEXE=$(FLEXLINK) -exe
+MKEXE=$(FLEXLINK) -exe -link /STACK:16777216
MKMAINDLL=$(FLEXLINK) -maindll
### How to build a static library
# #
#########################################################################
-# $Id: Makefile.msvc64 10461 2010-05-25 10:00:39Z frisch $
+# $Id: Makefile.msvc64 10622 2010-07-07 12:04:32Z frisch $
# Configuration for Windows, Visual C++ compiler
FLEXDIR=$(shell $(FLEXLINK) -where)
IFLEXDIR=-I"$(FLEXDIR)"
MKDLL=$(FLEXLINK)
-MKEXE=$(FLEXLINK) -exe
+MKEXE=$(FLEXLINK) -exe -link /STACK:33554432
MKMAINDLL=$(FLEXLINK) -maindll
### How to build a static library
# #
#########################################################################
-# $Id: configure 10490 2010-06-02 08:58:42Z xleroy $
+# $Id: configure 10626 2010-07-14 10:32:34Z xleroy $
configure_options="$*"
prefix=/usr/local
# Determine alignment constraints
case "$host" in
- sparc*-*-*|hppa*-*-*)
+ sparc*-*-*|hppa*-*-*|arm*-*-*)
# On Sparc V9 with certain versions of gcc, determination of double
# alignment is not reliable (PR#1521), hence force it.
# Same goes for hppa.
+ # PR#5088 suggests same problem on ARM.
# But there's a knack (PR#2572):
# if we're in 64-bit mode (sizeof(long) == 8),
# we must not doubleword-align floats...
if $int64_native; then
case "$host" in
- sparc*-*-*|hppa*-*-*)
+ # PR#5088: autodetection is unreliable on ARM
+ sparc*-*-*|hppa*-*-*|arm*-*-*)
if test $2 = 8; then
echo "64-bit integers can be word-aligned."
echo "#undef ARCH_ALIGN_INT64" >> m.h
# Look for BFD library
-if ./hasgot -i bfd.h -lbfd -ldl; then
+if ./hasgot -i bfd.h && \
+ ./hasgot -lbfd -ldl -liberty -lz bfd_openr; then
echo "BFD library found."
echo "#define HAS_LIBBFD" >> s.h
- echo "LIBBFD_LINK=-lbfd -ldl" >> Makefile
+ echo "LIBBFD_LINK=-lbfd -ldl -liberty -lz" >> Makefile
else
echo "BFD library not found, 'objinfo' will be unable to display info on .cmxs files"
echo "LIBBFD_LINK=" >> Makefile
(* *)
(***********************************************************************)
-(* $Id: main_args.ml 10444 2010-05-20 14:06:29Z doligez $ *)
+(* $Id: main_args.ml 10621 2010-07-06 14:05:26Z maranget $ *)
let mk_a f =
"-a", Arg.Unit f, " Build a library"
mk_nopervasives F._nopervasives;
mk_dparsetree F._dparsetree;
mk_drawlambda F._drawlambda;
+ mk_dlambda F._dlambda;
mk_dcmm F._dcmm;
mk_dsel F._dsel;
mk_dcombine F._dcombine;
(* Original author: Nicolas Pouillard *)
-let rec greedy _ = greedy
-let discard_printf _fmt = Obj.magic greedy
+let discard_printf fmt = Format.ifprintf Format.std_formatter fmt;;
#(* *)
#(***********************************************************************)
-# $Id: Makefile 9270 2009-05-20 11:52:42Z doligez $
+# $Id: Makefile 10584 2010-06-16 11:38:22Z guesdon $
include ../config/Makefile
###########
test: dummy
$(MKDIR) $@
- $(OCAMLDOC_RUN) -html -colorize-code -sort -d $@ $(INCLUDES) -dump $@/ocamldoc.odoc test.txt test2.txt odoc*.ml odoc*.mli -v
+ $(OCAMLDOC_RUN) -html -colorize-code -sort -d $@ $(INCLUDES) -dump $@/ocamldoc.odoc odoc*.ml odoc*.mli -v
test_stdlib: dummy
$(MKDIR) $@
(* *)
(***********************************************************************)
-(* $Id: odoc_text_lexer.mll 9638 2010-03-08 16:54:13Z guesdon $ *)
+(* $Id: odoc_text_lexer.mll 10584 2010-06-16 11:38:22Z guesdon $ *)
(** The lexer for string to build text structures. *)
Char (Lexing.lexeme lexbuf)
else
let s = Lexing.lexeme lexbuf in
- let tag = Odoc_misc.no_blanks s in
+ let len = String.length s in
+ (* remove this starting '{' *)
+ let tag = Odoc_misc.no_blanks (String.sub s 1 (len - 1)) in
CUSTOM tag
}
@echo " clean deletes generated files"
@echo " report prints the report for the last execution, if any"
-all:
+all: lib
@for dir in tests/*; do \
$(MAKE) $(NO_PRINT) exec-one DIR=$$dir; \
done 2>&1 | tee _log
@$(MAKE) report
-list:
+list: lib
@if [ -z $(FILE) ]; then echo "No value set for variable 'FILE'."; exit 1; fi
@if [ ! -f $(FILE) ]; then echo "File '$(FILE)' does not exist."; exit 1; fi
@while read LINE; do \
exec-one:
@echo "Running tests from '$$DIR' ..."
- @(cd $(DIR) && $(MAKE) BASEDIR=$(BASEDIR) && cd ../..)
+ @(cd $(DIR) && $(MAKE) TERM=dumb BASEDIR=$(BASEDIR) && cd ../..)
lib: FORCE
@(cd lib && $(MAKE) -s BASEDIR=$(BASEDIR) && cd ..)
# val get_x : < get_x : 'a; .. > -> 'a = <fun>
# val set_x : < set_x : 'a; .. > -> 'a = <fun>
# - : int list = [10; 5]
-# \e[A\e[A\e[A\e[A\e[A\e[A#
- class \e[4mref x_init = object
+# Characters 7-96:
+ ......ref x_init = object
val mutable x = x_init
method get = x
method set y = x <- y
- end\e[m;;
-\e[mError: Some type variables are unbound in this type:
+ end..
+Error: Some type variables are unbound in this type:
class ref :
'a ->
object
method move : int -> unit
method set_center : 'a -> unit
end
-# \e[A\e[A#
- let c'' = new color_circle \e[4mp\e[m;;
-\e[mError: This expression has type point but an expression was expected of type
+# Characters 28-29:
+ let c'' = new color_circle p;;
+ ^
+Error: This expression has type point but an expression was expected of type
#color_point
The first object type has no method color
# val c'' : color_point color_circle = <obj>
# - : color_point circle = <obj>
-# \e[A# \e[4m(c'' :> point circle)\e[m;; (* Echec *)
-\e[mError: Type
+# Characters 0-21:
+ (c'' :> point circle);; (* Echec *)
+ ^^^^^^^^^^^^^^^^^^^^^
+Error: Type
color_point color_circle =
< center : color_point; color : string; move : int -> unit;
set_center : color_point -> unit >
point circle =
< center : point; move : int -> unit; set_center : point -> unit >
Type point = point is not a subtype of color_point = color_point
-# \e[A# fun x -> \e[4m(x : color_point color_circle :> point circle)\e[m;;
-\e[mError: Type
+# Characters 9-55:
+ fun x -> (x : color_point color_circle :> point circle);;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Type
color_point color_circle =
< center : color_point; color : string; move : int -> unit;
set_center : color_point -> unit >
end
# val p : printable_point = <obj>
# 7- : unit = ()
-# \e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A#
- class printable_color_point y c = object (self)
- inherit color_point y c
- inherit \e[4mprintable_point y\e[m as super
- method print =
- print_string "(";
- super#print;
- print_string ", ";
- print_string (self#color);
- print_string ")"
- end;;
-\e[mWarning 13: the following instance variables are overridden by the class printable_point :
+# Characters 85-102:
+ inherit printable_point y as super
+ ^^^^^^^^^^^^^^^^^
+Warning 13: the following instance variables are overridden by the class printable_point :
x
The behaviour changed in ocaml 3.10 (previous behaviour was hiding.)
class printable_color_point :
# val c : int_comparable = <obj>
# - : unit = ()
# val c2 : int_comparable2 = <obj>
-# \e[A# l#add \e[4m(c2 :> int_comparable)\e[m;; (* Echec : 'a comp2 n'est un sous-type *)
-\e[mError: Type
+# Characters 6-28:
+ l#add (c2 :> int_comparable);; (* Echec : 'a comp2 n'est un sous-type *)
+ ^^^^^^^^^^^^^^^^^^^^^^
+Error: Type
int_comparable2 =
< leq : int_comparable2 -> bool; set_x : int -> unit; x : int >
is not a subtype of
end
# val c3 : int_comparable3 = <obj>
# - : unit = ()
-# \e[A# (new sorted_list ())#add \e[4mc3\e[m;; (* Echec : leq n'est pas binaire *)
-\e[mError: This expression has type
+# Characters 25-27:
+ (new sorted_list ())#add c3;; (* Echec : leq n'est pas binaire *)
+ ^^
+Error: This expression has type
int_comparable3 =
< leq : int_comparable -> bool; setx : int -> unit; x : int >
but an expression was expected of type
< leq : int_comparable -> bool; setx : int -> unit; x : int >
The first object type has no method setx
# val sort : (#comparable as 'a) list -> 'a list = <fun>
-# \e[A\e[A\e[A# let pr l =
- \e[4mList.map (fun c -> print_int c#x; print_string " ") l\e[m;
- print_newline ();;
-\e[mWarning 10: this expression should have type unit.
+# Characters 13-66:
+ List.map (fun c -> print_int c#x; print_string " ") l;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 10: this expression should have type unit.
val pr : < x : int; .. > list -> unit = <fun>
# val l : int_comparable list = [<obj>; <obj>; <obj>]
# 5 2 4
= <fun>
# class ['a] c : unit -> object constraint 'a = int method f : 'a c end
and ['a] d : unit -> object constraint 'a = int method f : 'a c end
-# \e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A# (* class ['a] c : unit -> object constraint 'a = int method f : 'a c end *)
- (* and ['a] d : unit -> object constraint 'a = int method f : 'a c end *)
-
- (* 'a libre dans classe d *)
- class ['a] c () = object
- method f (x : 'a) = ()
- end and \e[4md () = object
+# Characters 238-275:
+ ........d () = object
inherit ['a] c ()
- end\e[m;;
-\e[mError: Some type variables are unbound in this type:
+ end..
+Error: Some type variables are unbound in this type:
class d : unit -> object method f : 'a -> unit end
The method f has type 'a -> unit where 'a is unbound
# class virtual c : unit -> object end
# * class ['a] c :
'a -> object ('a) constraint 'a = < f : 'a; .. > method f : 'a end
# - : ('a c as 'a) -> 'a = <fun>
-# * \e[A\e[A\e[A\e[A\e[A\e[A\e[A# (* class ['a] c :
- 'a -> object ('a) constraint 'a = < f : 'a; .. > method f : 'a end *)
- (* - : ('a c as 'a) -> 'a = <fun> *)
-
- class \e[4mx () = object
+# * Characters 134-176:
+ ......x () = object
method virtual f : int
- end\e[m;;
-\e[mError: This class should be virtual. The following methods are undefined : f
-# \e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A# (* The class x should be virtual: its methods f is undefined *)
-
- (* Methode g en trop *)
- class virtual c ((x : 'a): < f : int >) = object \e[4m(_ : 'a)\e[m end
- and virtual d x = object (_ : 'a)
- inherit c x
- method g = true
- end;;
-\e[mError: This pattern cannot match self: it only matches values of type
+ end..
+Error: This class should be virtual. The following methods are undefined : f
+# Characters 139-147:
+ class virtual c ((x : 'a): < f : int >) = object (_ : 'a) end
+ ^^^^^^^^
+Error: This pattern cannot match self: it only matches values of type
< f : int >
-# \e[A\e[A\e[A\e[A\e[A\e[A#
- (* Contrainte non respectee *)
- class \e[4m['a] c () = object
+# Characters 38-110:
+ ......['a] c () = object
constraint 'a = int
method f x = (x : bool c)
- end\e[m;;
-\e[mError: The abbreviation c is used with parameters bool c
+ end..
+Error: The abbreviation c is used with parameters bool c
wich are incompatible with constraints int c
# class ['a, 'b] c :
unit ->
method f : 'a -> 'b -> unit
end
# val x : '_a list ref = {contents = []}
-# \e[A\e[A\e[A# class \e[4m['a] c () = object
+# Characters 6-50:
+ ......['a] c () = object
method f = (x : 'a)
- end\e[m;;
-\e[mError: The type of this class,
+ end..
+Error: The type of this class,
class ['a] c :
unit -> object constraint 'a = '_b list ref method f : 'a end,
contains type variables that cannot be generalized
-# \e[A\e[A\e[A\e[A#
- (* Abreviations *)
- type\e[4m 'a c = <f : 'a c; g : 'a d>\e[m
- and 'a d = <f : int c>;;
-\e[mError: In the definition of d, type int c should be 'a c
+# Characters 24-52:
+ type 'a c = <f : 'a c; g : 'a d>
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: In the definition of d, type int c should be 'a c
# type 'a c = < f : 'a c; g : 'a d >
and 'a d = < f : 'a c >
# type 'a c = < f : 'a c >
and 'a d = < f : int c >
# type 'a u = < x : 'a >
and 'a t = 'a t u
-# \e[A\e[A# type 'a u = 'a
- and\e[4m 'a t = 'a t u\e[m;;
-\e[mError: The type abbreviation t is cyclic
+# Characters 18-32:
+ and 'a t = 'a t u;;
+ ^^^^^^^^^^^^^^
+Error: The type abbreviation t is cyclic
# type 'a u = 'a
-# \e[A# type \e[4mt = t u * t u\e[m;;
-\e[mError: The type abbreviation t is cyclic
+# Characters 5-18:
+ type t = t u * t u;;
+ ^^^^^^^^^^^^^
+Error: The type abbreviation t is cyclic
# type t = < x : 'a > as 'a
# type 'a u = 'a
# - : t -> t u -> bool = <fun>
and d : unit -> object method f : int end
# class e : unit -> object method f : int end
# - : int = 2
-# \e[A# class c () = object val x = - \e[4mtrue\e[m val y = -. () end;;
-\e[mError: This expression has type bool but an expression was expected of type
+# Characters 30-34:
+ class c () = object val x = - true val y = -. () end;;
+ ^^^^
+Error: This expression has type bool but an expression was expected of type
int
# class c : unit -> object method f : int method g : int method h : int end
# class d : unit -> object method h : int method i : int method j : int end
# - : int * int * int * int * int = (1, 3, 2, 2, 3)
# class c : 'a -> object val a : 'a val x : int val y : int val z : int end
# class d : 'a -> object val b : 'a val t : int val u : int val z : int end
-# \e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A# class e () = object
- val x = 3
- inherit \e[4mc 5\e[m
- val y = 3
- val t = 3
- inherit d 7
- val u = 3
- method x = x
- method y = y
- method z = z
- method t = t
- method u = u
- method a = a
- method b = b
- end;;
-\e[mWarning 13: the following instance variables are overridden by the class c :
+# Characters 43-46:
+ inherit c 5
+ ^^^
+Warning 13: the following instance variables are overridden by the class c :
x
The behaviour changed in ocaml 3.10 (previous behaviour was hiding.)
-\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A# class e () = object
- val x = 3
- inherit c 5
- val \e[4my = 3\e[m
- val t = 3
- inherit d 7
- val u = 3
- method x = x
- method y = y
- method z = z
- method t = t
- method u = u
- method a = a
- method b = b
- end;;
-\e[m
-
-
+Characters 53-58:
+ val y = 3
+ ^^^^^
Warning 13: the instance variable y is overridden.
The behaviour changed in ocaml 3.10 (previous behaviour was hiding.)
-\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A# class e () = object
- val x = 3
- inherit c 5
- val y = 3
- val t = 3
- inherit \e[4md 7\e[m
- val u = 3
- method x = x
- method y = y
- method z = z
- method t = t
- method u = u
- method a = a
- method b = b
- end;;
-\e[m
-
-
-
-
+Characters 81-84:
+ inherit d 7
+ ^^^
Warning 13: the following instance variables are overridden by the class d :
t z
The behaviour changed in ocaml 3.10 (previous behaviour was hiding.)
Characters 91-96:
+ val u = 3
+ ^^^^^
Warning 13: the instance variable u is overridden.
The behaviour changed in ocaml 3.10 (previous behaviour was hiding.)
class e :
# * * * * * * * * * * * * * * * * * * * * * module M : sig class c : unit -> object method xc : int end end
# class d : unit -> object val x : int method xc : int method xd : int end
# - : int * int = (1, 2)
-# \e[A\e[A\e[A\e[A\e[A#
- class \e[4mvirtual ['a] matrix (sz, init : int * 'a) = object
+# Characters 7-156:
+ ......virtual ['a] matrix (sz, init : int * 'a) = object
val m = Array.create_matrix sz sz init
method add (mtx : 'a matrix) = (mtx#m.(0).(0) : 'a)
- end\e[m;;
-\e[mError: The abbreviation 'a matrix expands to type < add : 'a matrix -> 'a >
+ end..
+Error: The abbreviation 'a matrix expands to type < add : 'a matrix -> 'a >
but is used with type < m : 'a array array; .. >
# class c : unit -> object method m : c end
# - : c = <obj>
# type uu = A of int | B of (< leq : 'a > as 'a)
# class virtual c : unit -> object ('a) method virtual m : 'a end
# module S : sig val f : (#c as 'a) -> 'a end
-# \e[A\e[A\e[A\e[A\e[A# module S = (\e[4mstruct
+# Characters 12-43:
+ ............struct
let f (x : #c) = x
- end\e[m : sig
- val f : #c -> #c
- end);;
-\e[mError: Signature mismatch:
+ end......
+Error: Signature mismatch:
Modules do not match:
sig val f : (#c as 'a) -> 'a end
is not included in
val f : (#c as 'a) -> 'a
is not included in
val f : #c -> #c
-# \e[A\e[A#
- module M = struct type t = int \e[4mclass t () = object end\e[m end;;
-\e[mError: Multiple definition of the type name t.
+# Characters 32-55:
+ module M = struct type t = int class t () = object end end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^
+Error: Multiple definition of the type name t.
Names must be unique in a given structure or signature.
# - : < m : (< m : 'a > as 'b) -> 'b as 'a; .. > -> 'b = <fun>
-# \e[A\e[A#
- fun x -> \e[4m(x : int -> bool :> 'a -> 'a)\e[m;;
-\e[mError: Type int -> bool is not a subtype of int -> int
-# \e[A# fun x -> \e[4m(x : int -> bool :> int -> int)\e[m;;
-\e[mError: Type int -> bool is not a subtype of int -> int
+# Characters 10-39:
+ fun x -> (x : int -> bool :> 'a -> 'a);;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Type int -> bool is not a subtype of int -> int
+# Characters 9-40:
+ fun x -> (x : int -> bool :> int -> int);;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Type int -> bool is not a subtype of int -> int
# - : < > -> < > = <fun>
# - : < .. > -> < > = <fun>
# val x : '_a list ref = {contents = []}
# module F : functor (X : sig end) -> sig type t = int end
# - : < m : int > list ref = {contents = []}
# type 'a t
-# \e[A# fun (x : \e[4m'a t as 'a\e[m) -> ();;
-\e[mError: This alias is bound to type 'a t but is used as an instance of type 'a
-# \e[A# fun (x : 'a t) -> (\e[4mx\e[m : 'a); ();;
-\e[mError: This expression has type 'a t but an expression was expected of type
+# Characters 9-19:
+ fun (x : 'a t as 'a) -> ();;
+ ^^^^^^^^^^
+Error: This alias is bound to type 'a t but is used as an instance of type 'a
+# Characters 19-20:
+ fun (x : 'a t) -> (x : 'a); ();;
+ ^
+Error: This expression has type 'a t but an expression was expected of type
'a
# type 'a t = < x : 'a >
# - : ('a t as 'a) -> unit = <fun>
-# \e[A# fun (x : 'a t) -> \e[4m(x : 'a)\e[m; ();;
-\e[mWarning 10: this expression should have type unit.
+# Characters 18-26:
+ fun (x : 'a t) -> (x : 'a); ();;
+ ^^^^^^^^
+Warning 10: this expression should have type unit.
- : ('a t as 'a) -> unit = <fun>
# class ['a] c :
unit -> object constraint 'a = (< .. > as 'b) -> unit method m : 'a end
val c : circle = <obj>
val d : float = 11.4536240470737098
# val f : < m : 'a. 'a -> 'a > -> < m : 'b. 'b -> 'b > = <fun>
-# \e[A\e[A# let f (x : < m : 'a. 'a -> 'a list >) = (\e[4mx\e[m : < m : 'b. 'b -> 'c >)
- ;;
-\e[mError: This expression has type < m : 'a. 'a -> 'a list >
+# Characters 41-42:
+ let f (x : < m : 'a. 'a -> 'a list >) = (x : < m : 'b. 'b -> 'c >)
+ ^
+Error: This expression has type < m : 'a. 'a -> 'a list >
but an expression was expected of type < m : 'a. 'a -> 'b >
The universal variable 'a would escape its scope
# class id : object method id : 'a -> 'a end
# class id_impl : object method id : 'a -> 'a end
# class a : object method m : bool end
and b : object method id : 'a -> 'a end
-# \e[A\e[A\e[A\e[A\e[A\e[A#
- class ['a] id1 = object
- method virtual id : 'b. 'b -> 'a
- method id \e[4mx = x\e[m
- end
- ;;
-\e[mError: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
-# \e[A\e[A\e[A\e[A\e[A# class id2 (x : 'a) = object
- method virtual id : 'b. 'b -> 'a
- method id \e[4mx = x\e[m
- end
- ;;
-\e[mError: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
-# \e[A\e[A\e[A\e[A\e[A\e[A# class id3 x = object
- val x = x
- method virtual id : 'a. 'a -> 'a
- method id \e[4m_ = x\e[m
- end
- ;;
-\e[mError: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
-# \e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A# class id4 () = object
- val mutable r = None
- method virtual id : 'a. 'a -> 'a
- method id \e[4mx =
+# Characters 72-77:
+ method id x = x
+ ^^^^^
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
+# Characters 75-80:
+ method id x = x
+ ^^^^^
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
+# Characters 80-85:
+ method id _ = x
+ ^^^^^
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
+# Characters 92-159:
+ ............x =
match r with
None -> r <- Some x; x
- | Some y -> y\e[m
- end
- ;;
-\e[mError: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
+ | Some y -> y
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
# class c : object method m : 'a -> 'b -> 'a end
# val f1 : id -> int * bool = <fun>
# val f2 : id -> int * bool = <fun>
-# \e[A\e[A# let f3 f = f#id 1, f#id \e[4mtrue\e[m
- ;;
-\e[mError: This expression has type bool but an expression was expected of type
+# Characters 24-28:
+ let f3 f = f#id 1, f#id true
+ ^^^^
+Error: This expression has type bool but an expression was expected of type
int
-# \e[A\e[A# let f4 f = ignore(f : id); \e[4mf#id\e[m 1, f#id true
- ;;
-\e[mWarning 18: this use of a polymorphic method is not principal.
-\e[A\e[A\e[A# let f4 f = ignore(f : id); f#id 1, \e[4mf#id\e[m true
- ;;
-\e[m
+# Characters 27-31:
+ let f4 f = ignore(f : id); f#id 1, f#id true
+ ^^^^
+Warning 18: this use of a polymorphic method is not principal.
+Characters 35-39:
+ let f4 f = ignore(f : id); f#id 1, f#id true
+ ^^^^
Warning 18: this use of a polymorphic method is not principal.
val f4 : id -> int * bool = <fun>
# class c : object method m : #id -> int * bool end
# class id2 : object method id : 'a -> 'a method mono : int -> int end
# val app : int * bool = (1, true)
-# \e[A\e[A# type\e[4m 'a foo = 'a foo list\e[m
- ;;
-\e[mError: The type abbreviation foo is cyclic
+# Characters 4-25:
+ type 'a foo = 'a foo list
+ ^^^^^^^^^^^^^^^^^^^^^
+Error: The type abbreviation foo is cyclic
# class ['a] bar : 'a -> object end
# type 'a foo = 'a foo bar
# - : (< m : 'b. 'b * 'a > as 'a) -> 'c * (< m : 'e. 'e * 'd > as 'd) = <fun>
# class node : node_type
# class node : object method as_variant : [> `Node of node_type ] end
# type bad = { bad : 'a. 'a option ref; }
-# \e[A# let bad = {bad = \e[4mref None\e[m};;
-\e[mError: This field value has type 'a option ref which is less general than
+# Characters 17-25:
+ let bad = {bad = ref None};;
+ ^^^^^^^^
+Error: This field value has type 'a option ref which is less general than
'b. 'b option ref
# type bad2 = { mutable bad2 : 'a. 'a option ref option; }
# val bad2 : bad2 = {bad2 = None}
-# \e[A# bad2.bad2 <- \e[4mSome (ref None)\e[m;;
-\e[mError: This field value has type 'a option ref option
+# Characters 13-28:
+ bad2.bad2 <- Some (ref None);;
+ ^^^^^^^^^^^^^^^
+Error: This field value has type 'a option ref option
which is less general than 'b. 'b option ref option
# val f : < m : 'a. < p : 'a * 'b > as 'b > -> 'c -> unit = <fun>
# val f :
# class c : object method m : ([> 'a t ] as 'a) -> unit end
# class c : object method m : ([> 'a t ] as 'a) -> 'a end
# class c : object method m : ([> `A ] as 'a) option -> 'a end
-# \e[A\e[A\e[A\e[A\e[A\e[A#
- (* various old bugs *)
- class virtual ['a] visitor =
- object method virtual caseNil : 'a end
- and virtual int_list =
- object method virtual visit : \e[4m'a.('a visitor -> 'a)\e[m end;;
-\e[mError: This type scheme cannot quantify 'a :
+# Characters 145-166:
+ object method virtual visit : 'a.('a visitor -> 'a) end;;
+ ^^^^^^^^^^^^^^^^^^^^^
+Error: This type scheme cannot quantify 'a :
it escapes this scope.
# type ('a, 'b) list_visitor = < caseCons : 'b -> 'b list -> 'a; caseNil : 'a >
type 'a alist = < visit : 'b. ('b, 'a) list_visitor -> 'b >
class type ct = object ('a) method fold : ('b -> 'a -> 'b) -> 'b -> 'b end
type t = { f : 'a 'b. ('b -> (#ct as 'a) -> 'b) -> 'b; }
-# \e[A\e[A\e[A#
- (* PR#1663 *)
- type \e[4mt = u\e[m and u = t;;
-\e[mError: The type abbreviation t is cyclic
+# Characters 20-25:
+ type t = u and u = t;;
+ ^^^^^
+Error: The type abbreviation t is cyclic
# class ['a] a : object constraint 'a = [> `A of 'a a ] end
type t = [ `A of t a ]
-# \e[A\e[A\e[A#
- (* Wrong in 3.06 *)
- type ('a,'b) t constraint 'a = 'b and ('a,'b) u = \e[4m('a,'b) t\e[m;;
-\e[mError: Constraints are not satisfied in this type.
+# Characters 71-80:
+ type ('a,'b) t constraint 'a = 'b and ('a,'b) u = ('a,'b) t;;
+ ^^^^^^^^^
+Error: Constraints are not satisfied in this type.
Type ('a, 'b) t should be an instance of ('c, 'c) t
# type 'a t = 'a
and u = int t
# type 'a t constraint 'a = int
-# \e[A# type 'a u = 'a and 'a v = \e[4m'a u t\e[m;;
-\e[mError: Constraints are not satisfied in this type.
+# Characters 26-32:
+ type 'a u = 'a and 'a v = 'a u t;;
+ ^^^^^^
+Error: Constraints are not satisfied in this type.
Type 'a u t should be an instance of int t
# type 'a u = 'a constraint 'a = int
and 'a v = 'a u t constraint 'a = int
# type g = int
# type 'a t = unit constraint 'a = g
-# \e[A# type 'a u = 'a and 'a v = \e[4m'a u t\e[m;;
-\e[mError: Constraints are not satisfied in this type.
+# Characters 26-32:
+ type 'a u = 'a and 'a v = 'a u t;;
+ ^^^^^^
+Error: Constraints are not satisfied in this type.
Type 'a u t should be an instance of g t
# type 'a u = 'a constraint 'a = g
and 'a v = 'a u t constraint 'a = int
-# \e[A\e[A\e[A#
- (* Example of wrong expansion *)
- type\e[4m 'a u = < m : 'a v >\e[m and 'a v = 'a list u;;
-\e[mError: In the definition of v, type 'a list u should be 'a u
+# Characters 38-58:
+ type 'a u = < m : 'a v > and 'a v = 'a list u;;
+ ^^^^^^^^^^^^^^^^^^^^
+Error: In the definition of v, type 'a list u should be 'a u
# type 'a t = 'a
type 'a u = A of 'a t
# type 'a t = < a : 'a >
# - : [> `A ] option * t -> int = <fun>
# - : t * [< `A | `B ] -> int = <fun>
# - : [< `A | `B ] * t -> int = <fun>
-# \e[A# \e[4mfunction (`A|`B), _ -> 0 | _,(`A|`B) -> 1\e[m;;
-\e[mWarning 8: this pattern-matching is not exhaustive.
+# Characters 0-41:
+ function (`A|`B), _ -> 0 | _,(`A|`B) -> 1;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(`AnyExtraTag, `AnyExtraTag)
- : [> `A | `B ] * [> `A | `B ] -> int = <fun>
-# \e[A# \e[4mfunction `B,1 -> 1 | _,1 -> 2\e[m;;
-\e[mWarning 8: this pattern-matching is not exhaustive.
+# Characters 0-29:
+ function `B,1 -> 1 | _,1 -> 2;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(_, 0)
-\e[A\e[A\e[A\e[A# function `B,1 -> 1 | \e[4m_,1\e[m -> 2;;
-\e[m
-
-
+Characters 21-24:
+ function `B,1 -> 1 | _,1 -> 2;;
+ ^^^
Warning 11: this match case is unused.
- : [< `B ] * int -> int = <fun>
-# \e[A# \e[4mfunction 1,`B -> 1 | 1,_ -> 2\e[m;;
-\e[mWarning 8: this pattern-matching is not exhaustive.
+# Characters 0-29:
+ function 1,`B -> 1 | 1,_ -> 2;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(0, _)
-\e[A\e[A\e[A\e[A# function 1,`B -> 1 | \e[4m1,_\e[m -> 2;;
-\e[m
-
-
+Characters 21-24:
+ function 1,`B -> 1 | 1,_ -> 2;;
+ ^^^
Warning 11: this match case is unused.
- : int * [< `B ] -> int = <fun>
-# \e[A\e[A\e[A\e[A#
- (* pass typetexp, but fails during Typedecl.check_recursion *)
- type \e[4m('a, 'b) a = 'a -> unit constraint 'a = [> `B of ('a, 'b) b as 'b]\e[m
- and ('a, 'b) b = 'b -> unit constraint 'b = [> `A of ('a, 'b) a as 'a];;
-\e[mError: Constraints are not satisfied in this type.
+# Characters 69-135:
+ type ('a, 'b) a = 'a -> unit constraint 'a = [> `B of ('a, 'b) b as 'b]
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Constraints are not satisfied in this type.
Type
([> `B of 'a ], 'a) b as 'a
should be an instance of
# class c : object method m : int end
# val f : unit -> c = <fun>
# val f : unit -> c = <fun>
-# \e[A# let f () = \e[4mobject method private n = 1 method m = {<>}#n end\e[m;;
-\e[mWarning 15: the following private methods were made public implicitly:
+# Characters 11-60:
+ let f () = object method private n = 1 method m = {<>}#n end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 15: the following private methods were made public implicitly:
n.
val f : unit -> < m : int; n : int > = <fun>
-# \e[A# let f () = \e[4mobject (self:c) method n = 1 method m = 2 end\e[m;;
-\e[mError: This object is expected to have type c but actually has type
+# Characters 11-56:
+ let f () = object (self:c) method n = 1 method m = 2 end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This object is expected to have type c but actually has type
< m : int; n : 'a >
The first object type has no method n
-# \e[A# let f () = \e[4mobject (_:'s) constraint 's = < n : int > method m = 1 end\e[m;;
-\e[mError: This object is expected to have type < n : int > but actually has type
+# Characters 11-69:
+ let f () = object (_:'s) constraint 's = < n : int > method m = 1 end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This object is expected to have type < n : int > but actually has type
< m : 'a >
The second object type has no method n
-# \e[A\e[A\e[A\e[A\e[A# class c = object (_ : 's)
- method x = 1
- method private m =
- \e[4mobject (self: 's) method x = 3 method private m = self end\e[m
- end;;
-\e[mError: This object is expected to have type < x : int; .. >
+# Characters 66-124:
+ object (self: 's) method x = 3 method private m = self end
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This object is expected to have type < x : int; .. >
but actually has type < x : int >
Self type cannot be unified with a closed object type
# val o : < x : int > = <obj>
-# \e[A\e[A\e[A\e[A\e[A#
-
- (* Unsound! *)
- fun (x : <m : 'a. 'a * <m: 'b. 'a * 'foo> > as 'foo) ->
- (\e[4mx\e[m : <m : 'a. 'a * (<m:'b. 'a * <m:'c. 'c * 'bar> > as 'bar) >);;
-\e[mError: This expression has type < m : 'b. 'b * < m : 'b * 'a > > as 'a
+# Characters 76-77:
+ (x : <m : 'a. 'a * (<m:'b. 'a * <m:'c. 'c * 'bar> > as 'bar) >);;
+ ^
+Error: This expression has type < m : 'b. 'b * < m : 'b * 'a > > as 'a
but an expression was expected of type
< m : 'b. 'b * (< m : 'b * < m : 'd. 'd * 'c > > as 'c) >
Types for method m are incompatible
-# \e[A\e[A\e[A\e[A\e[A# type 'a foo = <m: 'b. 'a * 'a foo>
- type foo' = <m: 'a. 'a * 'a foo>
- type 'a bar = <m: 'b. 'a * <m: 'c. 'c * 'a bar> >
- type bar' = <m: 'a. 'a * 'a bar >
- let f (x : foo') = (\e[4mx\e[m : bar');;
-\e[mError: This expression has type foo' = < m : 'a. 'a * 'a foo >
+# Characters 176-177:
+ let f (x : foo') = (x : bar');;
+ ^
+Error: This expression has type foo' = < m : 'a. 'a * 'a foo >
but an expression was expected of type bar' = < m : 'a. 'a * 'a bar >
Type 'a foo = < m : 'a * 'a foo > is not compatible with type
'a bar = < m : 'a * < m : 'b. 'b * 'a bar > >
Type 'a foo = < m : 'a * 'a foo > is not compatible with type
< m : 'b. 'b * 'a bar >
Types for method m are incompatible
-# \e[A\e[A\e[A#
- fun (x : <m : 'a. 'a * ('a * <m : 'a. 'a * 'foo> as 'foo)>) ->
- (\e[4mx\e[m : <m : 'b. 'b * ('b * <m : 'c. 'c * ('c * 'bar)>)> as 'bar);;
-\e[mError: This expression has type
+# Characters 67-68:
+ (x : <m : 'b. 'b * ('b * <m : 'c. 'c * ('c * 'bar)>)> as 'bar);;
+ ^
+Error: This expression has type
< m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) >
but an expression was expected of type
< m : 'a. 'a * ('a * < m : 'c. 'c * ('c * 'd) >) > as 'd
Types for method m are incompatible
-# \e[A\e[A# fun (x : <m : 'a. 'a * ('a * <m : 'a. 'a * 'foo> as 'foo)>) ->
- (\e[4mx\e[m : <m : 'b. 'b * ('b * <m : 'c. 'c * ('b * 'bar)>)> as 'bar);;
-\e[mError: This expression has type
+# Characters 66-67:
+ (x : <m : 'b. 'b * ('b * <m : 'c. 'c * ('b * 'bar)>)> as 'bar);;
+ ^
+Error: This expression has type
< m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) >
but an expression was expected of type
< m : 'a. 'a * ('a * < m : 'c. 'c * ('a * 'd) >) > as 'd
Types for method m are incompatible
-# \e[A\e[A# fun (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) ->
- (\e[4mx\e[m : <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>);;
-\e[mError: This expression has type < m : 'b. 'b * ('b * 'a) > as 'a
+# Characters 51-52:
+ (x : <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>);;
+ ^
+Error: This expression has type < m : 'b. 'b * ('b * 'a) > as 'a
but an expression was expected of type
< m : 'b. 'b * ('b * < m : 'd. 'd * 'c > as 'c) >
Types for method m are incompatible
-# \e[A\e[A\e[A# let f x =
- \e[4m(x : <m : 'a. 'a -> ('a * <m:'c. 'c -> 'bar> as 'bar)>
- :> <m : 'a. 'a -> ('a * 'foo)> as 'foo)\e[m;;
-\e[mError: Type < m : 'a. 'a -> ('a * (< m : 'd. 'd -> 'b as 'e > as 'c) as 'b) >
+# Characters 14-115:
+ ....(x : <m : 'a. 'a -> ('a * <m:'c. 'c -> 'bar> as 'bar)>
+ :> <m : 'a. 'a -> ('a * 'foo)> as 'foo)..
+Error: Type < m : 'a. 'a -> ('a * (< m : 'd. 'd -> 'b as 'e > as 'c) as 'b) >
is not a subtype of < m : 'a. 'a -> ('a * 'f as 'h) as 'g > as 'f
-# \e[A\e[A\e[A\e[A#
- module M
- : sig val f : (<m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>) -> unit end
- = \e[4mstruct let f (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) = () end\e[m;;
-\e[mError: Signature mismatch:
+# Characters 88-150:
+ = struct let f (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) = () end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Signature mismatch:
Modules do not match:
sig val f : (< m : 'b. 'b * ('b * 'a) > as 'a) -> unit end
is not included in
val f : (< m : 'b. 'b * ('b * 'a) > as 'a) -> unit
is not included in
val f : < m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) > -> unit
-# \e[A\e[A\e[A# module M
- : sig type t = <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)> end
- = \e[4mstruct type t = <m : 'a. 'a * ('a * 'foo)> as 'foo end\e[m;;
-\e[mError: Signature mismatch:
+# Characters 78-132:
+ = struct type t = <m : 'a. 'a * ('a * 'foo)> as 'foo end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Signature mismatch:
Modules do not match:
sig type t = < m : 'b. 'b * ('b * 'a) > as 'a end
is not included in
# - : t -> v = <fun>
# type u = private [< t ]
# - : u -> v = <fun>
-# \e[A# fun x -> \e[4m(x : v :> u)\e[m;;
-\e[mError: Type v = [> `A | `B ] is not a subtype of u = [< `A | `B ]
+# Characters 9-21:
+ fun x -> (x : v :> u);;
+ ^^^^^^^^^^^^
+Error: Type v = [> `A | `B ] is not a subtype of u = [< `A | `B ]
# type v = private [< t ]
-# \e[A# fun x -> \e[4m(x : u :> v)\e[m;;
-\e[mError: Type u = [< `A | `B ] is not a subtype of v = [< `A | `B ]
+# Characters 9-21:
+ fun x -> (x : u :> v);;
+ ^^^^^^^^^^^^
+Error: Type u = [< `A | `B ] is not a subtype of v = [< `A | `B ]
# type p = < x : p >
# type q = private < x : p; .. >
# - : q -> p = <fun>
-# \e[A# fun x -> \e[4m(x : p :> q)\e[m;;
-\e[mError: Type p = < x : p > is not a subtype of q = < x : p; .. >
-# \e[A\e[A\e[A\e[A#
- let f1 x =
- \e[4m(x : <m:'a. (<p:int;..> as 'a) -> int>
- :> <m:'b. (<p:int;q:int;..> as 'b) -> int>)\e[m;;
-\e[mError: Type < m : 'a. (< p : int; .. > as 'a) -> int > is not a subtype of
+# Characters 9-21:
+ fun x -> (x : p :> q);;
+ ^^^^^^^^^^^^
+Error: Type p = < x : p > is not a subtype of q = < x : p; .. >
+# Characters 14-100:
+ ..(x : <m:'a. (<p:int;..> as 'a) -> int>
+ :> <m:'b. (<p:int;q:int;..> as 'b) -> int>)..
+Error: Type < m : 'a. (< p : int; .. > as 'a) -> int > is not a subtype of
< m : 'b. (< p : int; q : int; .. > as 'b) -> int >
# val f2 :
< m : 'a. (< p : < a : int >; .. > as 'a) -> int > ->
< m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int > = <fun>
-# \e[A\e[A\e[A# let f3 x =
- \e[4m(x : <m:'a. (<p:<a:int;b:int>;..> as 'a) -> int>
- :> <m:'b. (<p:<a:int>;..> as 'b) -> int>)\e[m;;
-\e[mError: Type < m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int >
+# Characters 13-107:
+ ..(x : <m:'a. (<p:<a:int;b:int>;..> as 'a) -> int>
+ :> <m:'b. (<p:<a:int>;..> as 'b) -> int>)..
+Error: Type < m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int >
is not a subtype of < m : 'a. (< p : < a : int >; .. > as 'a) -> int >
-# \e[A# let f4 x = \e[4m(x : <p:<a:int;b:int>;..> :> <p:<a:int>;..>)\e[m;;
-\e[mError: Type < p : < a : int; b : int >; .. > is not a subtype of
+# Characters 11-55:
+ let f4 x = (x : <p:<a:int;b:int>;..> :> <p:<a:int>;..>);;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Type < p : < a : int; b : int >; .. > is not a subtype of
< p : < a : int >; .. >
The second object type has no method b
# val f5 :
< m : 'a. [< `A of < p : int > ] as 'a > ->
< m : 'a. [< `A of < > ] as 'a > = <fun>
-# \e[A\e[A# let f6 x =
- \e[4m(x : <m:'a. [< `A of < > ] as 'a> :> <m:'a. [< `A of <p:int> ] as 'a>)\e[m;;
-\e[mError: Type < m : 'a. [< `A of < > ] as 'a > is not a subtype of
+# Characters 13-83:
+ (x : <m:'a. [< `A of < > ] as 'a> :> <m:'a. [< `A of <p:int> ] as 'a>);;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Type < m : 'a. [< `A of < > ] as 'a > is not a subtype of
< m : 'a. [< `A of < p : int > ] as 'a >
# class c : object method id : 'a -> 'a end
# type u = c option
val g : 'a -> int = <fun>
# type 'a t = Leaf of 'a | Node of ('a * 'a) t
# val depth : 'a t -> int = <fun>
-# \e[A\e[A\e[A# let rec depth : 'a. 'a t -> _ =
- \e[4mfunction Leaf _ -> 1 | Node x -> 1 + d x\e[m
- and d x = depth x;; (* fails *)
-\e[mError: This definition has type 'a t -> int which is less general than
+# Characters 34-74:
+ function Leaf _ -> 1 | Node x -> 1 + d x
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type 'a t -> int which is less general than
'b. 'b t -> int
-# \e[A\e[A# let rec depth : 'a. 'a t -> _ =
- \e[4mfunction Leaf x -> x | Node x -> 1 + depth x\e[m;; (* fails *)
-\e[mError: This definition has type int t -> int which is less general than
+# Characters 34-78:
+ function Leaf x -> x | Node x -> 1 + depth x;; (* fails *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type int t -> int which is less general than
'a. 'a t -> int
-# \e[A\e[A# let rec depth : 'a. 'a t -> _ =
- \e[4mfunction Leaf x -> x | Node x -> depth x\e[m;; (* fails *)
-\e[mError: This definition has type 'a t -> 'a which is less general than
+# Characters 34-74:
+ function Leaf x -> x | Node x -> depth x;; (* fails *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type 'a t -> 'a which is less general than
'b. 'b t -> 'a
-# \e[A\e[A# let rec depth : 'a 'b. 'a t -> 'b =
- \e[4mfunction Leaf x -> x | Node x -> depth x\e[m;; (* fails *)
-\e[mError: This definition has type 'a. 'a t -> 'a which is less general than
+# Characters 38-78:
+ function Leaf x -> x | Node x -> depth x;; (* fails *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type 'a. 'a t -> 'a which is less general than
'b 'c. 'c t -> 'b
# val r : 'a list * '_b list ref = ([], {contents = []})
val q : unit -> 'a list * '_b list ref = <fun>
# val f : 'a -> 'a = <fun>
# val zero : [> `B of 'a | `Int of int ] as 'a = `Int 0
-# \e[A# let zero : 'a. [< `Int of int] as 'a = \e[4m`Int 0\e[m;; (* fails *)
-\e[mError: This expression has type [> `Int of int ]
+# Characters 39-45:
+ let zero : 'a. [< `Int of int] as 'a = `Int 0;; (* fails *)
+ ^^^^^^
+Error: This expression has type [> `Int of int ]
but an expression was expected of type [< `Int of int ]
Types for tag `Int are incompatible
# type t = { f : 'a. [> `B of 'a | `Int of int ] as 'a; }
val zero : t = {f = `Int 0}
-# \e[A\e[A# type t = {f: 'a. [< `Int of int] as 'a}
- let zero = {f = \e[4m`Int 0\e[m} ;; (* fails *)
-\e[mError: This expression has type [> `Int of int ]
+# Characters 56-62:
+ let zero = {f = `Int 0} ;; (* fails *)
+ ^^^^^^
+Error: This expression has type [> `Int of int ]
but an expression was expected of type [< `Int of int ]
Types for tag `Int are incompatible
# val id : 'a -> 'a = <fun>
val l : t = {f = <lazy>}
# type t = { f : 'a. 'a -> unit; }
# - : t = {f = <fun>}
-# \e[A# {f=\e[4mfun ?x y -> y\e[m};; (* fail *)
-\e[mError: This field value has type unit -> unit which is less general than
+# Characters 3-16:
+ {f=fun ?x y -> y};; (* fail *)
+ ^^^^^^^^^^^^^
+Error: This field value has type unit -> unit which is less general than
'a. 'a -> unit
#
val c : circle = <obj>
val d : float = 11.4536240470737098
# val f : < m : 'a. 'a -> 'a > -> < m : 'a. 'a -> 'a > = <fun>
-# \e[A\e[A# let f (x : < m : 'a. 'a -> 'a list >) = (\e[4mx\e[m : < m : 'b. 'b -> 'c >)
- ;;
-\e[mError: This expression has type < m : 'a. 'a -> 'a list >
+# Characters 41-42:
+ let f (x : < m : 'a. 'a -> 'a list >) = (x : < m : 'b. 'b -> 'c >)
+ ^
+Error: This expression has type < m : 'a. 'a -> 'a list >
but an expression was expected of type < m : 'a. 'a -> 'b >
The universal variable 'a would escape its scope
# class id : object method id : 'a -> 'a end
# class id_impl : object method id : 'a -> 'a end
# class a : object method m : bool end
and b : object method id : 'a -> 'a end
-# \e[A\e[A\e[A\e[A\e[A\e[A#
- class ['a] id1 = object
- method virtual id : 'b. 'b -> 'a
- method id \e[4mx = x\e[m
- end
- ;;
-\e[mError: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
-# \e[A\e[A\e[A\e[A\e[A# class id2 (x : 'a) = object
- method virtual id : 'b. 'b -> 'a
- method id \e[4mx = x\e[m
- end
- ;;
-\e[mError: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
-# \e[A\e[A\e[A\e[A\e[A\e[A# class id3 x = object
- val x = x
- method virtual id : 'a. 'a -> 'a
- method id \e[4m_ = x\e[m
- end
- ;;
-\e[mError: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
-# \e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A\e[A# class id4 () = object
- val mutable r = None
- method virtual id : 'a. 'a -> 'a
- method id \e[4mx =
+# Characters 72-77:
+ method id x = x
+ ^^^^^
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
+# Characters 75-80:
+ method id x = x
+ ^^^^^
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
+# Characters 80-85:
+ method id _ = x
+ ^^^^^
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
+# Characters 92-159:
+ ............x =
match r with
None -> r <- Some x; x
- | Some y -> y\e[m
- end
- ;;
-\e[mError: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
+ | Some y -> y
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
# class c : object method m : 'a -> 'b -> 'a end
# val f1 : id -> int * bool = <fun>
# val f2 : id -> int * bool = <fun>
-# \e[A\e[A# let f3 f = f#id 1, f#id \e[4mtrue\e[m
- ;;
-\e[mError: This expression has type bool but an expression was expected of type
+# Characters 24-28:
+ let f3 f = f#id 1, f#id true
+ ^^^^
+Error: This expression has type bool but an expression was expected of type
int
# val f4 : id -> int * bool = <fun>
# class c : object method m : #id -> int * bool end
# class id2 : object method id : 'a -> 'a method mono : int -> int end
# val app : int * bool = (1, true)
-# \e[A\e[A# type\e[4m 'a foo = 'a foo list\e[m
- ;;
-\e[mError: The type abbreviation foo is cyclic
+# Characters 4-25:
+ type 'a foo = 'a foo list
+ ^^^^^^^^^^^^^^^^^^^^^
+Error: The type abbreviation foo is cyclic
# class ['a] bar : 'a -> object end
# type 'a foo = 'a foo bar
# - : (< m : 'b. 'b * 'a > as 'a) -> 'c * 'a = <fun>
# class node : node_type
# class node : object method as_variant : [> `Node of node_type ] end
# type bad = { bad : 'a. 'a option ref; }
-# \e[A# let bad = {bad = \e[4mref None\e[m};;
-\e[mError: This field value has type 'a option ref which is less general than
+# Characters 17-25:
+ let bad = {bad = ref None};;
+ ^^^^^^^^
+Error: This field value has type 'a option ref which is less general than
'b. 'b option ref
# type bad2 = { mutable bad2 : 'a. 'a option ref option; }
# val bad2 : bad2 = {bad2 = None}
-# \e[A# bad2.bad2 <- \e[4mSome (ref None)\e[m;;
-\e[mError: This field value has type 'a option ref option
+# Characters 13-28:
+ bad2.bad2 <- Some (ref None);;
+ ^^^^^^^^^^^^^^^
+Error: This field value has type 'a option ref option
which is less general than 'b. 'b option ref option
# val f : < m : 'a. < p : 'a * 'b > as 'b > -> 'c -> unit = <fun>
# val f : < m : 'a. 'a * (< p : int * 'b > as 'b) > -> 'b -> unit = <fun>
# class c : object method m : ([> 'a t ] as 'a) -> unit end
# class c : object method m : ([> 'a t ] as 'a) -> 'a end
# class c : object method m : ([> `A ] as 'a) option -> 'a end
-# \e[A\e[A\e[A\e[A\e[A\e[A#
- (* various old bugs *)
- class virtual ['a] visitor =
- object method virtual caseNil : 'a end
- and virtual int_list =
- object method virtual visit : \e[4m'a.('a visitor -> 'a)\e[m end;;
-\e[mError: This type scheme cannot quantify 'a :
+# Characters 145-166:
+ object method virtual visit : 'a.('a visitor -> 'a) end;;
+ ^^^^^^^^^^^^^^^^^^^^^
+Error: This type scheme cannot quantify 'a :
it escapes this scope.
# type ('a, 'b) list_visitor = < caseCons : 'b -> 'b list -> 'a; caseNil : 'a >
type 'a alist = < visit : 'b. ('b, 'a) list_visitor -> 'b >
class type ct = object ('a) method fold : ('b -> 'a -> 'b) -> 'b -> 'b end
type t = { f : 'a 'b. ('b -> (#ct as 'a) -> 'b) -> 'b; }
-# \e[A\e[A\e[A#
- (* PR#1663 *)
- type \e[4mt = u\e[m and u = t;;
-\e[mError: The type abbreviation t is cyclic
+# Characters 20-25:
+ type t = u and u = t;;
+ ^^^^^
+Error: The type abbreviation t is cyclic
# class ['a] a : object constraint 'a = [> `A of 'a a ] end
type t = [ `A of t a ]
-# \e[A\e[A\e[A#
- (* Wrong in 3.06 *)
- type ('a,'b) t constraint 'a = 'b and ('a,'b) u = \e[4m('a,'b) t\e[m;;
-\e[mError: Constraints are not satisfied in this type.
+# Characters 71-80:
+ type ('a,'b) t constraint 'a = 'b and ('a,'b) u = ('a,'b) t;;
+ ^^^^^^^^^
+Error: Constraints are not satisfied in this type.
Type ('a, 'b) t should be an instance of ('c, 'c) t
# type 'a t = 'a
and u = int t
# type 'a t constraint 'a = int
-# \e[A# type 'a u = 'a and 'a v = \e[4m'a u t\e[m;;
-\e[mError: Constraints are not satisfied in this type.
+# Characters 26-32:
+ type 'a u = 'a and 'a v = 'a u t;;
+ ^^^^^^
+Error: Constraints are not satisfied in this type.
Type 'a u t should be an instance of int t
# type 'a u = 'a constraint 'a = int
and 'a v = 'a u t constraint 'a = int
# type g = int
# type 'a t = unit constraint 'a = g
-# \e[A# type 'a u = 'a and 'a v = \e[4m'a u t\e[m;;
-\e[mError: Constraints are not satisfied in this type.
+# Characters 26-32:
+ type 'a u = 'a and 'a v = 'a u t;;
+ ^^^^^^
+Error: Constraints are not satisfied in this type.
Type 'a u t should be an instance of g t
# type 'a u = 'a constraint 'a = g
and 'a v = 'a u t constraint 'a = int
-# \e[A\e[A\e[A#
- (* Example of wrong expansion *)
- type\e[4m 'a u = < m : 'a v >\e[m and 'a v = 'a list u;;
-\e[mError: In the definition of v, type 'a list u should be 'a u
+# Characters 38-58:
+ type 'a u = < m : 'a v > and 'a v = 'a list u;;
+ ^^^^^^^^^^^^^^^^^^^^
+Error: In the definition of v, type 'a list u should be 'a u
# type 'a t = 'a
type 'a u = A of 'a t
# type 'a t = < a : 'a >
# - : [> `A ] option * t -> int = <fun>
# - : t * [< `A | `B ] -> int = <fun>
# - : [< `A | `B ] * t -> int = <fun>
-# \e[A# \e[4mfunction (`A|`B), _ -> 0 | _,(`A|`B) -> 1\e[m;;
-\e[mWarning 8: this pattern-matching is not exhaustive.
+# Characters 0-41:
+ function (`A|`B), _ -> 0 | _,(`A|`B) -> 1;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(`AnyExtraTag, `AnyExtraTag)
- : [> `A | `B ] * [> `A | `B ] -> int = <fun>
-# \e[A# \e[4mfunction `B,1 -> 1 | _,1 -> 2\e[m;;
-\e[mWarning 8: this pattern-matching is not exhaustive.
+# Characters 0-29:
+ function `B,1 -> 1 | _,1 -> 2;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(_, 0)
-\e[A\e[A\e[A\e[A# function `B,1 -> 1 | \e[4m_,1\e[m -> 2;;
-\e[m
-
-
+Characters 21-24:
+ function `B,1 -> 1 | _,1 -> 2;;
+ ^^^
Warning 11: this match case is unused.
- : [< `B ] * int -> int = <fun>
-# \e[A# \e[4mfunction 1,`B -> 1 | 1,_ -> 2\e[m;;
-\e[mWarning 8: this pattern-matching is not exhaustive.
+# Characters 0-29:
+ function 1,`B -> 1 | 1,_ -> 2;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(0, _)
-\e[A\e[A\e[A\e[A# function 1,`B -> 1 | \e[4m1,_\e[m -> 2;;
-\e[m
-
-
+Characters 21-24:
+ function 1,`B -> 1 | 1,_ -> 2;;
+ ^^^
Warning 11: this match case is unused.
- : int * [< `B ] -> int = <fun>
-# \e[A\e[A\e[A\e[A#
- (* pass typetexp, but fails during Typedecl.check_recursion *)
- type \e[4m('a, 'b) a = 'a -> unit constraint 'a = [> `B of ('a, 'b) b as 'b]\e[m
- and ('a, 'b) b = 'b -> unit constraint 'b = [> `A of ('a, 'b) a as 'a];;
-\e[mError: Constraints are not satisfied in this type.
+# Characters 69-135:
+ type ('a, 'b) a = 'a -> unit constraint 'a = [> `B of ('a, 'b) b as 'b]
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Constraints are not satisfied in this type.
Type
([> `B of 'a ], 'a) b as 'a
should be an instance of
# class c : object method m : int end
# val f : unit -> c = <fun>
# val f : unit -> c = <fun>
-# \e[A# let f () = \e[4mobject method private n = 1 method m = {<>}#n end\e[m;;
-\e[mWarning 15: the following private methods were made public implicitly:
+# Characters 11-60:
+ let f () = object method private n = 1 method m = {<>}#n end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 15: the following private methods were made public implicitly:
n.
val f : unit -> < m : int; n : int > = <fun>
-# \e[A# let f () = \e[4mobject (self:c) method n = 1 method m = 2 end\e[m;;
-\e[mError: This object is expected to have type c but actually has type
+# Characters 11-56:
+ let f () = object (self:c) method n = 1 method m = 2 end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This object is expected to have type c but actually has type
< m : int; n : 'a >
The first object type has no method n
-# \e[A# let f () = \e[4mobject (_:'s) constraint 's = < n : int > method m = 1 end\e[m;;
-\e[mError: This object is expected to have type < n : int > but actually has type
+# Characters 11-69:
+ let f () = object (_:'s) constraint 's = < n : int > method m = 1 end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This object is expected to have type < n : int > but actually has type
< m : 'a >
The second object type has no method n
-# \e[A\e[A\e[A\e[A\e[A# class c = object (_ : 's)
- method x = 1
- method private m =
- \e[4mobject (self: 's) method x = 3 method private m = self end\e[m
- end;;
-\e[mError: This object is expected to have type < x : int; .. >
+# Characters 66-124:
+ object (self: 's) method x = 3 method private m = self end
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This object is expected to have type < x : int; .. >
but actually has type < x : int >
Self type cannot be unified with a closed object type
# val o : < x : int > = <obj>
-# \e[A\e[A\e[A\e[A\e[A#
-
- (* Unsound! *)
- fun (x : <m : 'a. 'a * <m: 'b. 'a * 'foo> > as 'foo) ->
- (\e[4mx\e[m : <m : 'a. 'a * (<m:'b. 'a * <m:'c. 'c * 'bar> > as 'bar) >);;
-\e[mError: This expression has type < m : 'b. 'b * < m : 'b * 'a > > as 'a
+# Characters 76-77:
+ (x : <m : 'a. 'a * (<m:'b. 'a * <m:'c. 'c * 'bar> > as 'bar) >);;
+ ^
+Error: This expression has type < m : 'b. 'b * < m : 'b * 'a > > as 'a
but an expression was expected of type
< m : 'b. 'b * (< m : 'b * < m : 'd. 'd * 'c > > as 'c) >
Types for method m are incompatible
-# \e[A\e[A\e[A\e[A\e[A# type 'a foo = <m: 'b. 'a * 'a foo>
- type foo' = <m: 'a. 'a * 'a foo>
- type 'a bar = <m: 'b. 'a * <m: 'c. 'c * 'a bar> >
- type bar' = <m: 'a. 'a * 'a bar >
- let f (x : foo') = (\e[4mx\e[m : bar');;
-\e[mError: This expression has type foo' = < m : 'a. 'a * 'a foo >
+# Characters 176-177:
+ let f (x : foo') = (x : bar');;
+ ^
+Error: This expression has type foo' = < m : 'a. 'a * 'a foo >
but an expression was expected of type bar' = < m : 'a. 'a * 'a bar >
Type 'a foo = < m : 'a * 'a foo > is not compatible with type
'a bar = < m : 'a * < m : 'b. 'b * 'a bar > >
Type 'a foo = < m : 'a * 'a foo > is not compatible with type
< m : 'b. 'b * 'a bar >
Types for method m are incompatible
-# \e[A\e[A\e[A#
- fun (x : <m : 'a. 'a * ('a * <m : 'a. 'a * 'foo> as 'foo)>) ->
- (\e[4mx\e[m : <m : 'b. 'b * ('b * <m : 'c. 'c * ('c * 'bar)>)> as 'bar);;
-\e[mError: This expression has type
+# Characters 67-68:
+ (x : <m : 'b. 'b * ('b * <m : 'c. 'c * ('c * 'bar)>)> as 'bar);;
+ ^
+Error: This expression has type
< m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) >
but an expression was expected of type
< m : 'a. 'a * ('a * < m : 'c. 'c * ('c * 'd) >) > as 'd
Types for method m are incompatible
-# \e[A\e[A# fun (x : <m : 'a. 'a * ('a * <m : 'a. 'a * 'foo> as 'foo)>) ->
- (\e[4mx\e[m : <m : 'b. 'b * ('b * <m : 'c. 'c * ('b * 'bar)>)> as 'bar);;
-\e[mError: This expression has type
+# Characters 66-67:
+ (x : <m : 'b. 'b * ('b * <m : 'c. 'c * ('b * 'bar)>)> as 'bar);;
+ ^
+Error: This expression has type
< m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) >
but an expression was expected of type
< m : 'a. 'a * ('a * < m : 'c. 'c * ('a * 'd) >) > as 'd
Types for method m are incompatible
-# \e[A\e[A# fun (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) ->
- (\e[4mx\e[m : <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>);;
-\e[mError: This expression has type < m : 'b. 'b * ('b * 'a) > as 'a
+# Characters 51-52:
+ (x : <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>);;
+ ^
+Error: This expression has type < m : 'b. 'b * ('b * 'a) > as 'a
but an expression was expected of type
< m : 'b. 'b * ('b * < m : 'd. 'd * 'c > as 'c) >
Types for method m are incompatible
-# \e[A\e[A\e[A# let f x =
- \e[4m(x : <m : 'a. 'a -> ('a * <m:'c. 'c -> 'bar> as 'bar)>
- :> <m : 'a. 'a -> ('a * 'foo)> as 'foo)\e[m;;
-\e[mError: Type < m : 'a. 'a -> ('a * (< m : 'd. 'd -> 'b as 'e > as 'c) as 'b) >
+# Characters 14-115:
+ ....(x : <m : 'a. 'a -> ('a * <m:'c. 'c -> 'bar> as 'bar)>
+ :> <m : 'a. 'a -> ('a * 'foo)> as 'foo)..
+Error: Type < m : 'a. 'a -> ('a * (< m : 'd. 'd -> 'b as 'e > as 'c) as 'b) >
is not a subtype of < m : 'a. 'a -> ('a * 'f as 'h) as 'g > as 'f
-# \e[A\e[A\e[A\e[A#
- module M
- : sig val f : (<m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>) -> unit end
- = \e[4mstruct let f (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) = () end\e[m;;
-\e[mError: Signature mismatch:
+# Characters 88-150:
+ = struct let f (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) = () end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Signature mismatch:
Modules do not match:
sig val f : (< m : 'b. 'b * ('b * 'a) > as 'a) -> unit end
is not included in
val f : (< m : 'b. 'b * ('b * 'a) > as 'a) -> unit
is not included in
val f : < m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) > -> unit
-# \e[A\e[A\e[A# module M
- : sig type t = <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)> end
- = \e[4mstruct type t = <m : 'a. 'a * ('a * 'foo)> as 'foo end\e[m;;
-\e[mError: Signature mismatch:
+# Characters 78-132:
+ = struct type t = <m : 'a. 'a * ('a * 'foo)> as 'foo end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Signature mismatch:
Modules do not match:
sig type t = < m : 'b. 'b * ('b * 'a) > as 'a end
is not included in
# - : t -> v = <fun>
# type u = private [< t ]
# - : u -> v = <fun>
-# \e[A# fun x -> \e[4m(x : v :> u)\e[m;;
-\e[mError: Type v = [> `A | `B ] is not a subtype of u = [< `A | `B ]
+# Characters 9-21:
+ fun x -> (x : v :> u);;
+ ^^^^^^^^^^^^
+Error: Type v = [> `A | `B ] is not a subtype of u = [< `A | `B ]
# type v = private [< t ]
-# \e[A# fun x -> \e[4m(x : u :> v)\e[m;;
-\e[mError: Type u = [< `A | `B ] is not a subtype of v = [< `A | `B ]
+# Characters 9-21:
+ fun x -> (x : u :> v);;
+ ^^^^^^^^^^^^
+Error: Type u = [< `A | `B ] is not a subtype of v = [< `A | `B ]
# type p = < x : p >
# type q = private < x : p; .. >
# - : q -> p = <fun>
-# \e[A# fun x -> \e[4m(x : p :> q)\e[m;;
-\e[mError: Type p = < x : p > is not a subtype of q = < x : p; .. >
-# \e[A\e[A\e[A\e[A#
- let f1 x =
- \e[4m(x : <m:'a. (<p:int;..> as 'a) -> int>
- :> <m:'b. (<p:int;q:int;..> as 'b) -> int>)\e[m;;
-\e[mError: Type < m : 'a. (< p : int; .. > as 'a) -> int > is not a subtype of
+# Characters 9-21:
+ fun x -> (x : p :> q);;
+ ^^^^^^^^^^^^
+Error: Type p = < x : p > is not a subtype of q = < x : p; .. >
+# Characters 14-100:
+ ..(x : <m:'a. (<p:int;..> as 'a) -> int>
+ :> <m:'b. (<p:int;q:int;..> as 'b) -> int>)..
+Error: Type < m : 'a. (< p : int; .. > as 'a) -> int > is not a subtype of
< m : 'b. (< p : int; q : int; .. > as 'b) -> int >
# val f2 :
< m : 'a. (< p : < a : int >; .. > as 'a) -> int > ->
< m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int > = <fun>
-# \e[A\e[A\e[A# let f3 x =
- \e[4m(x : <m:'a. (<p:<a:int;b:int>;..> as 'a) -> int>
- :> <m:'b. (<p:<a:int>;..> as 'b) -> int>)\e[m;;
-\e[mError: Type < m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int >
+# Characters 13-107:
+ ..(x : <m:'a. (<p:<a:int;b:int>;..> as 'a) -> int>
+ :> <m:'b. (<p:<a:int>;..> as 'b) -> int>)..
+Error: Type < m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int >
is not a subtype of < m : 'a. (< p : < a : int >; .. > as 'a) -> int >
-# \e[A# let f4 x = \e[4m(x : <p:<a:int;b:int>;..> :> <p:<a:int>;..>)\e[m;;
-\e[mError: Type < p : < a : int; b : int >; .. > is not a subtype of
+# Characters 11-55:
+ let f4 x = (x : <p:<a:int;b:int>;..> :> <p:<a:int>;..>);;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Type < p : < a : int; b : int >; .. > is not a subtype of
< p : < a : int >; .. >
The second object type has no method b
# val f5 :
< m : 'a. [< `A of < p : int > ] as 'a > ->
< m : 'a. [< `A of < > ] as 'a > = <fun>
-# \e[A\e[A# let f6 x =
- \e[4m(x : <m:'a. [< `A of < > ] as 'a> :> <m:'a. [< `A of <p:int> ] as 'a>)\e[m;;
-\e[mError: Type < m : 'a. [< `A of < > ] as 'a > is not a subtype of
+# Characters 13-83:
+ (x : <m:'a. [< `A of < > ] as 'a> :> <m:'a. [< `A of <p:int> ] as 'a>);;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Type < m : 'a. [< `A of < > ] as 'a > is not a subtype of
< m : 'a. [< `A of < p : int > ] as 'a >
# class c : object method id : 'a -> 'a end
# type u = c option
val g : 'a -> int = <fun>
# type 'a t = Leaf of 'a | Node of ('a * 'a) t
# val depth : 'a t -> int = <fun>
-# \e[A\e[A\e[A# let rec depth : 'a. 'a t -> _ =
- \e[4mfunction Leaf _ -> 1 | Node x -> 1 + d x\e[m
- and d x = depth x;; (* fails *)
-\e[mError: This definition has type 'a t -> int which is less general than
+# Characters 34-74:
+ function Leaf _ -> 1 | Node x -> 1 + d x
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type 'a t -> int which is less general than
'b. 'b t -> int
-# \e[A\e[A# let rec depth : 'a. 'a t -> _ =
- \e[4mfunction Leaf x -> x | Node x -> 1 + depth x\e[m;; (* fails *)
-\e[mError: This definition has type int t -> int which is less general than
+# Characters 34-78:
+ function Leaf x -> x | Node x -> 1 + depth x;; (* fails *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type int t -> int which is less general than
'a. 'a t -> int
-# \e[A\e[A# let rec depth : 'a. 'a t -> _ =
- \e[4mfunction Leaf x -> x | Node x -> depth x\e[m;; (* fails *)
-\e[mError: This definition has type 'a t -> 'a which is less general than
+# Characters 34-74:
+ function Leaf x -> x | Node x -> depth x;; (* fails *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type 'a t -> 'a which is less general than
'b. 'b t -> 'a
-# \e[A\e[A# let rec depth : 'a 'b. 'a t -> 'b =
- \e[4mfunction Leaf x -> x | Node x -> depth x\e[m;; (* fails *)
-\e[mError: This definition has type 'a. 'a t -> 'a which is less general than
+# Characters 38-78:
+ function Leaf x -> x | Node x -> depth x;; (* fails *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type 'a. 'a t -> 'a which is less general than
'b 'c. 'c t -> 'b
# val r : 'a list * '_b list ref = ([], {contents = []})
val q : unit -> 'a list * '_b list ref = <fun>
# val f : 'a -> 'a = <fun>
# val zero : [> `B of 'a | `Int of int ] as 'a = `Int 0
-# \e[A# let zero : 'a. [< `Int of int] as 'a = \e[4m`Int 0\e[m;; (* fails *)
-\e[mError: This expression has type [> `Int of int ]
+# Characters 39-45:
+ let zero : 'a. [< `Int of int] as 'a = `Int 0;; (* fails *)
+ ^^^^^^
+Error: This expression has type [> `Int of int ]
but an expression was expected of type [< `Int of int ]
Types for tag `Int are incompatible
# type t = { f : 'a. [> `B of 'a | `Int of int ] as 'a; }
val zero : t = {f = `Int 0}
-# \e[A\e[A# type t = {f: 'a. [< `Int of int] as 'a}
- let zero = {f = \e[4m`Int 0\e[m} ;; (* fails *)
-\e[mError: This expression has type [> `Int of int ]
+# Characters 56-62:
+ let zero = {f = `Int 0} ;; (* fails *)
+ ^^^^^^
+Error: This expression has type [> `Int of int ]
but an expression was expected of type [< `Int of int ]
Types for tag `Int are incompatible
# val id : 'a -> 'a = <fun>
val l : t = {f = <lazy>}
# type t = { f : 'a. 'a -> unit; }
# - : t = {f = <fun>}
-# \e[A# {f=\e[4mfun ?x y -> y\e[m};; (* fail *)
-\e[mError: This field value has type unit -> unit which is less general than
+# Characters 3-16:
+ {f=fun ?x y -> y};; (* fail *)
+ ^^^^^^^^^^^^^
+Error: This field value has type unit -> unit which is less general than
'a. 'a -> unit
#
# module Foobar : sig type t = private int end
# module F0 : sig type t = private int end
-# \e[A\e[A#
- let f (x : F0.t) = (\e[4mx\e[m : Foobar.t);; (* fails *)
-\e[mError: This expression has type F0.t but an expression was expected of type
+# Characters 21-22:
+ let f (x : F0.t) = (x : Foobar.t);; (* fails *)
+ ^
+Error: This expression has type F0.t but an expression was expected of type
Foobar.t
# module F : sig type t = Foobar.t end
# val f : F.t -> F.t = <fun>
# module M : sig type t = < m : int > end
# module M1 : sig type t = private < m : int; .. > end
# module M2 : sig type t = private < m : int; .. > end
-# \e[A# fun (x : M1.t) -> (\e[4mx\e[m : M2.t);; (* fails *)
-\e[mError: This expression has type M1.t but an expression was expected of type
+# Characters 19-20:
+ fun (x : M1.t) -> (x : M2.t);; (* fails *)
+ ^
+Error: This expression has type M1.t but an expression was expected of type
M2.t
# module M3 : sig type t = private M1.t end
# - : M3.t -> M1.t = <fun>
# - : M3.t -> M.t = <fun>
-# \e[A# module M4 : sig type t = private M3.t end = \e[4mM2\e[m;; (* fails *)
-\e[mError: Signature mismatch:
+# Characters 44-46:
+ module M4 : sig type t = private M3.t end = M2;; (* fails *)
+ ^^
+Error: Signature mismatch:
Modules do not match:
sig type t = M2.t end
is not included in
type t = M2.t
is not included in
type t = private M3.t
-# \e[A# module M4 : sig type t = private M3.t end = \e[4mM\e[m;; (* fails *)
-\e[mError: Signature mismatch:
+# Characters 44-45:
+ module M4 : sig type t = private M3.t end = M;; (* fails *)
+ ^
+Error: Signature mismatch:
Modules do not match:
sig type t = < m : int > end
is not included in
type t = < m : int >
is not included in
type t = private M3.t
-# \e[A# module M4 : sig type t = private M3.t end = \e[4mM1\e[m;; (* might be ok *)
-\e[mError: Signature mismatch:
+# Characters 44-46:
+ module M4 : sig type t = private M3.t end = M1;; (* might be ok *)
+ ^^
+Error: Signature mismatch:
Modules do not match:
sig type t = M1.t end
is not included in
is not included in
type t = private M3.t
# module M5 : sig type t = private M1.t end
-# \e[A# module M6 : sig type t = private < n:int; .. > end = \e[4mM1\e[m;; (* fails *)
-\e[mError: Signature mismatch:
+# Characters 53-55:
+ module M6 : sig type t = private < n:int; .. > end = M1;; (* fails *)
+ ^^
+Error: Signature mismatch:
Modules do not match:
sig type t = M1.t end
is not included in
type t = M1.t
is not included in
type t = private < n : int; .. >
-# \e[A\e[A\e[A#
- module Bar : sig type t = private Foobar.t val f : int -> t end =
- \e[4mstruct type t = int let f (x : int) = (x : t) end\e[m;; (* must fail *)
-\e[mError: Signature mismatch:
+# Characters 69-118:
+ struct type t = int let f (x : int) = (x : t) end;; (* must fail *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Signature mismatch:
Modules do not match:
sig type t = int val f : t -> t end
is not included in
# module M1 : sig type t = M.t val mk : int -> t end
# module M2 : sig type t = M.t val mk : int -> t end
# module M3 : sig type t = M.t val mk : int -> t end
-# \e[A\e[A\e[A\e[A\e[A#
- module M4 : sig
- type \e[4mt = M.t = T of int\e[m
- val mk : int -> t
- end = M;;
-\e[mError: This variant or record definition does not match that of type M.t
+# Characters 29-47:
+ type t = M.t = T of int
+ ^^^^^^^^^^^^^^^^^^
+Error: This variant or record definition does not match that of type M.t
A private type would be revealed.
# module M5 : sig type t = M.t = private T of int val mk : int -> t end
# module M6 : sig type t = private T of int val mk : int -> t end
(* *)
(***********************************************************************)
-(* $Id: ctype.ml 10544 2010-06-08 14:09:30Z garrigue $ *)
+(* $Id: ctype.ml 10605 2010-06-24 08:43:39Z garrigue $ *)
(* Operations on core types *)
let restore_global_level gl =
global_level := gl
-(* Abbreviations without parameters *)
+(**** Whether a path points to an object type (with hidden row variable) ****)
+let is_object_type path =
+ let name =
+ match path with Path.Pident id -> Ident.name id
+ | Path.Pdot(_, s,_) -> s
+ | Path.Papply _ -> assert false
+ in name.[0] = '#'
+
+(**** Abbreviations without parameters ****)
(* Shall reset after generalizing *)
let simple_abbrevs = ref Mnil
let proper_abbrevs path tl abbrev =
- if !Clflags.principal || tl <> [] then abbrev else
- let name = match path with Path.Pident id -> Ident.name id
- | Path.Pdot(_, s,_) -> s
- | Path.Papply _ -> assert false in
- if name.[0] <> '#' then simple_abbrevs else abbrev
+ if !Clflags.principal || tl <> [] || is_object_type path then abbrev
+ else simple_abbrevs
(**** Some type creators ****)
normalize_subst subst;
if List.assq t1 !subst != t2 then raise (Unify [])
with Not_found ->
- (*if List.exists (fun (_, t) -> t == t2) !subst then raise (Unify []);*)
+ if List.exists (fun (_, t) -> t == t2) !subst then raise (Unify []);
subst := (t1, t2) :: !subst
end
| (Tconstr (p1, [], _), Tconstr (p2, [], _)) when Path.same p1 p2 ->
normalize_subst subst;
if List.assq t1' !subst != t2' then raise (Unify [])
with Not_found ->
- (*if List.exists (fun (_, t) -> t == t2') !subst then raise (Unify []);*)
+ if List.exists (fun (_, t) -> t == t2') !subst then raise (Unify []);
subst := (t1', t2') :: !subst
end
| (Tarrow (l1, t1, u1, _), Tarrow (l2, t2, u2, _)) when l1 = l2
| _ ->
raise (Failure [])
with
- Failure error when trace ->
+ Failure error when trace || error = [] ->
raise (Failure (CM_Class_type_mismatch (cty1, cty2)::error))
let match_class_types ?(trace=true) env pat_sch subj_sch =
| _ ->
newty2 ty.level ty.desc
-let unroll_abbrev id tl ty =
- let ty = repr ty in
- if (ty.desc = Tvar) || (List.exists (deep_occur ty) tl) then
- ty
- else
- let ty' = newty2 ty.level ty.desc in
- link_type ty (newty2 ty.level (Tconstr (Path.Pident id, tl, ref Mnil)));
- ty'
-
(* Return the arity (as for curried functions) of the given type. *)
let rec arity ty =
match (repr ty).desc with
clear_hash ();
raise Not_found
+let unroll_abbrev id tl ty =
+ let ty = repr ty and path = Path.Pident id in
+ if (ty.desc = Tvar) || (List.exists (deep_occur ty) tl)
+ || is_object_type path then
+ ty
+ else
+ let ty' = newty2 ty.level ty.desc in
+ link_type ty (newty2 ty.level (Tconstr (path, tl, ref Mnil)));
+ ty'
+
(* Preserve sharing inside type declarations. *)
let nondep_type_decl env mid id is_covariant decl =
try
(* *)
(***********************************************************************)
-(* $Id: typecore.ml 10540 2010-06-08 03:20:26Z garrigue $ *)
+(* $Id: typecore.ml 10624 2010-07-12 09:36:07Z garrigue $ *)
(* Typechecking for the core language *)
Vars.fold (fun _ (mut,_,_) b -> decr count; b && mut = Immutable)
vars true &&
!count = 0
+ | Texp_pack mexp ->
+ is_nonexpansive_mod mexp
| _ -> false
+and is_nonexpansive_mod mexp =
+ match mexp.mod_desc with
+ | Tmod_ident _ -> true
+ | Tmod_functor _ -> true
+ | Tmod_unpack (e, _) -> is_nonexpansive e
+ | Tmod_constraint (m, _, _) -> is_nonexpansive_mod m
+ | Tmod_structure items ->
+ List.for_all
+ (function
+ | Tstr_eval _ | Tstr_primitive _ | Tstr_type _ | Tstr_modtype _
+ | Tstr_open _ | Tstr_cltype _ | Tstr_exn_rebind _ -> true
+ | Tstr_value (_, pat_exp_list) ->
+ List.for_all (fun (_, exp) -> is_nonexpansive exp) pat_exp_list
+ | Tstr_module (_, m) | Tstr_include (m, _) -> is_nonexpansive_mod m
+ | Tstr_recmodule id_mod_list ->
+ List.for_all (fun (_, m) -> is_nonexpansive_mod m) id_mod_list
+ | Tstr_exception _ -> false (* true would be unsound *)
+ | Tstr_class _ -> false (* could be more precise *)
+ )
+ items
+ | Tmod_apply _ -> false
+
and is_nonexpansive_opt = function
None -> true
| Some e -> is_nonexpansive e