summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/tests/typing-misc/ocamltests1
-rw-r--r--testsuite/tests/typing-misc/scope_escape.ml15
2 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/typing-misc/ocamltests b/testsuite/tests/typing-misc/ocamltests
index 5bad7b5f4c..f1db9c4c06 100644
--- a/testsuite/tests/typing-misc/ocamltests
+++ b/testsuite/tests/typing-misc/ocamltests
@@ -15,6 +15,7 @@ pr7228.ml
pr7668_bad.ml
printing.ml
records.ml
+scope_escape.ml
unique_names_in_unification.ml
variant.ml
wellfounded.ml
diff --git a/testsuite/tests/typing-misc/scope_escape.ml b/testsuite/tests/typing-misc/scope_escape.ml
new file mode 100644
index 0000000000..8f57363bf8
--- /dev/null
+++ b/testsuite/tests/typing-misc/scope_escape.ml
@@ -0,0 +1,15 @@
+(* TEST
+ * expect
+*)
+
+let x = ref []
+module M = struct type t let _ = (x : t list ref) end;;
+[%%expect{|
+val x : '_weak1 list ref = {contents = []}
+Line 2, characters 34-35:
+ module M = struct type t let _ = (x : t list ref) end;;
+ ^
+Error: This expression has type 'weak1 list ref
+ but an expression was expected of type t list ref
+ The type constructor t would escape its scope
+|}]