summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-short-paths
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/typing-short-paths')
-rw-r--r--testsuite/tests/typing-short-paths/Makefile16
-rw-r--r--testsuite/tests/typing-short-paths/pr5918.ml7
-rw-r--r--testsuite/tests/typing-short-paths/pr5918.ml.reference6
-rw-r--r--testsuite/tests/typing-short-paths/short-paths.ml48
-rw-r--r--testsuite/tests/typing-short-paths/short-paths.ml.reference117
5 files changed, 194 insertions, 0 deletions
diff --git a/testsuite/tests/typing-short-paths/Makefile b/testsuite/tests/typing-short-paths/Makefile
new file mode 100644
index 0000000000..3b7cbaa3b3
--- /dev/null
+++ b/testsuite/tests/typing-short-paths/Makefile
@@ -0,0 +1,16 @@
+#########################################################################
+# #
+# OCaml #
+# #
+# Xavier Clerc, SED, INRIA Rocquencourt #
+# #
+# Copyright 2010 Institut National de Recherche en Informatique et #
+# en Automatique. All rights reserved. This file is distributed #
+# under the terms of the Q Public License version 1.0. #
+# #
+#########################################################################
+
+BASEDIR=../..
+include $(BASEDIR)/makefiles/Makefile.toplevel
+include $(BASEDIR)/makefiles/Makefile.common
+TOPFLAGS = -short-paths
diff --git a/testsuite/tests/typing-short-paths/pr5918.ml b/testsuite/tests/typing-short-paths/pr5918.ml
new file mode 100644
index 0000000000..604f66d84f
--- /dev/null
+++ b/testsuite/tests/typing-short-paths/pr5918.ml
@@ -0,0 +1,7 @@
+module rec A : sig
+ type t
+end = struct
+ type t = { a : unit; b : unit }
+ let _ = { a = () }
+end
+;;
diff --git a/testsuite/tests/typing-short-paths/pr5918.ml.reference b/testsuite/tests/typing-short-paths/pr5918.ml.reference
new file mode 100644
index 0000000000..3364e16d29
--- /dev/null
+++ b/testsuite/tests/typing-short-paths/pr5918.ml.reference
@@ -0,0 +1,6 @@
+
+# Characters 82-92:
+ let _ = { a = () }
+ ^^^^^^^^^^
+Error: Some record fields are undefined: b
+#
diff --git a/testsuite/tests/typing-short-paths/short-paths.ml b/testsuite/tests/typing-short-paths/short-paths.ml
new file mode 100644
index 0000000000..5616090606
--- /dev/null
+++ b/testsuite/tests/typing-short-paths/short-paths.ml
@@ -0,0 +1,48 @@
+module Core = struct
+ module Int = struct
+ module T = struct
+ type t = int
+ let compare = compare
+ let (+) x y = x + y
+ end
+ include T
+ module Map = Map.Make(T)
+ end
+
+ module Std = struct
+ module Int = Int
+ end
+end
+;;
+
+open Core.Std
+;;
+
+let x = Int.Map.empty ;;
+let y = x + x ;;
+
+(* Avoid ambiguity *)
+
+module M = struct type t = A type u = C end
+module N = struct type t = B end
+open M open N;;
+A;;
+B;;
+C;;
+
+include M open M;;
+C;;
+
+module L = struct type v = V end
+open L;;
+V;;
+module L = struct type v = V end
+open L;;
+V;;
+
+
+type t1 = A;;
+module M1 = struct type u = v and v = t1 end;;
+module N1 = struct type u = v and v = M1.v end;;
+type t1 = B;;
+module N2 = struct type u = v and v = M1.v end;;
diff --git a/testsuite/tests/typing-short-paths/short-paths.ml.reference b/testsuite/tests/typing-short-paths/short-paths.ml.reference
new file mode 100644
index 0000000000..4c1a991a50
--- /dev/null
+++ b/testsuite/tests/typing-short-paths/short-paths.ml.reference
@@ -0,0 +1,117 @@
+
+# module Core :
+ sig
+ module Int :
+ sig
+ module T :
+ sig
+ type t = int
+ val compare : 'a -> 'a -> t
+ val ( + ) : t -> t -> t
+ end
+ type t = int
+ val compare : 'a -> 'a -> t
+ val ( + ) : t -> t -> t
+ module Map :
+ sig
+ type key = t
+ type 'a t = 'a Map.Make(T).t
+ val empty : 'a t
+ val is_empty : 'a t -> bool
+ val mem : key -> 'a t -> bool
+ val add : key -> 'a -> 'a t -> 'a t
+ val singleton : key -> 'a -> 'a t
+ val remove : key -> 'a t -> 'a t
+ val merge :
+ (key -> 'a option -> 'b option -> 'c option) ->
+ 'a t -> 'b t -> 'c t
+ val compare : ('a -> 'a -> key) -> 'a t -> 'a t -> key
+ val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
+ val iter : (key -> 'a -> unit) -> 'a t -> unit
+ val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
+ val for_all : (key -> 'a -> bool) -> 'a t -> bool
+ val exists : (key -> 'a -> bool) -> 'a t -> bool
+ val filter : (key -> 'a -> bool) -> 'a t -> 'a t
+ val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
+ val cardinal : 'a t -> key
+ val bindings : 'a t -> (key * 'a) list
+ val min_binding : 'a t -> key * 'a
+ val max_binding : 'a t -> key * 'a
+ val choose : 'a t -> key * 'a
+ val split : key -> 'a t -> 'a t * 'a option * 'a t
+ val find : key -> 'a t -> 'a
+ val map : ('a -> 'b) -> 'a t -> 'b t
+ val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
+ end
+ end
+ module Std :
+ sig
+ module Int :
+ sig
+ module T :
+ sig
+ type t = int
+ val compare : 'a -> 'a -> t
+ val ( + ) : t -> t -> t
+ end
+ type t = int
+ val compare : 'a -> 'a -> t
+ val ( + ) : t -> t -> t
+ module Map :
+ sig
+ type key = t
+ type 'a t = 'a Map.Make(T).t
+ val empty : 'a t
+ val is_empty : 'a t -> bool
+ val mem : key -> 'a t -> bool
+ val add : key -> 'a -> 'a t -> 'a t
+ val singleton : key -> 'a -> 'a t
+ val remove : key -> 'a t -> 'a t
+ val merge :
+ (key -> 'a option -> 'b option -> 'c option) ->
+ 'a t -> 'b t -> 'c t
+ val compare : ('a -> 'a -> key) -> 'a t -> 'a t -> key
+ val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
+ val iter : (key -> 'a -> unit) -> 'a t -> unit
+ val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
+ val for_all : (key -> 'a -> bool) -> 'a t -> bool
+ val exists : (key -> 'a -> bool) -> 'a t -> bool
+ val filter : (key -> 'a -> bool) -> 'a t -> 'a t
+ val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
+ val cardinal : 'a t -> key
+ val bindings : 'a t -> (key * 'a) list
+ val min_binding : 'a t -> key * 'a
+ val max_binding : 'a t -> key * 'a
+ val choose : 'a t -> key * 'a
+ val split : key -> 'a t -> 'a t * 'a option * 'a t
+ val find : key -> 'a t -> 'a
+ val map : ('a -> 'b) -> 'a t -> 'b t
+ val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
+ end
+ end
+ end
+ end
+# # val x : 'a Int.Map.t = <abstr>
+# Characters 8-9:
+ let y = x + x ;;
+ ^
+Error: This expression has type 'a Int.Map.t
+ but an expression was expected of type int
+# module M : sig type t = A type u = C end
+module N : sig type t = B end
+# - : M.t = A
+# - : N.t = B
+# - : u = C
+# type t = M.t = A
+type u = M.u = C
+# - : u = C
+# module L : sig type v = V end
+# - : v = V
+# module L : sig type v = V end
+# - : v = V
+# type t1 = A
+# module M1 : sig type u = v and v = t1 end
+# module N1 : sig type u = v and v = t1 end
+# type t1 = B
+# module N2 : sig type u = v and v = N1.v end
+#