summaryrefslogtreecommitdiffstats
path: root/testsuite/tests/typing-objects
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/typing-objects')
-rw-r--r--testsuite/tests/typing-objects/Tests.ml7
-rw-r--r--testsuite/tests/typing-objects/Tests.ml.principal.reference8
-rw-r--r--testsuite/tests/typing-objects/Tests.ml.reference8
3 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/typing-objects/Tests.ml b/testsuite/tests/typing-objects/Tests.ml
index c7a5cb3d1..759f5d955 100644
--- a/testsuite/tests/typing-objects/Tests.ml
+++ b/testsuite/tests/typing-objects/Tests.ml
@@ -325,3 +325,10 @@ let o = object val x = 33 val y = 44 method m = x end in
let o' : <m:int> = Marshal.from_string s 0 in
let o'' : <m:int> = Marshal.from_string s 0 in
(Oo.id o, Oo.id o', Oo.id o'', o#m, o'#m);;
+
+(* Recursion (cf. PR#5291) *)
+
+class a = let _ = new b in object end
+and b = let _ = new a in object end;;
+
+class a = let _ = new a in object end;;
diff --git a/testsuite/tests/typing-objects/Tests.ml.principal.reference b/testsuite/tests/typing-objects/Tests.ml.principal.reference
index 34a5071d7..ff3980e26 100644
--- a/testsuite/tests/typing-objects/Tests.ml.principal.reference
+++ b/testsuite/tests/typing-objects/Tests.ml.principal.reference
@@ -299,4 +299,12 @@ Warning 10: this expression should have type unit.
# - : int * int * int = (18, 19, 20)
# - : int * int * int * int * int = (21, 22, 23, 33, 33)
# - : int * int * int * int * int = (24, 25, 26, 33, 33)
+# Characters 42-69:
+ class a = let _ = new b in object end
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This kind of recursive class expression is not allowed
+# Characters 11-38:
+ class a = let _ = new a in object end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This kind of recursive class expression is not allowed
#
diff --git a/testsuite/tests/typing-objects/Tests.ml.reference b/testsuite/tests/typing-objects/Tests.ml.reference
index 45130d58c..098096597 100644
--- a/testsuite/tests/typing-objects/Tests.ml.reference
+++ b/testsuite/tests/typing-objects/Tests.ml.reference
@@ -298,4 +298,12 @@ Warning 10: this expression should have type unit.
# - : int * int * int = (18, 19, 20)
# - : int * int * int * int * int = (21, 22, 23, 33, 33)
# - : int * int * int * int * int = (24, 25, 26, 33, 33)
+# Characters 42-69:
+ class a = let _ = new b in object end
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This kind of recursive class expression is not allowed
+# Characters 11-38:
+ class a = let _ = new a in object end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This kind of recursive class expression is not allowed
#