diff --git a/testsuite/tests/typing-layouts-unboxed-records/recursive.ml b/testsuite/tests/typing-layouts-unboxed-records/recursive.ml index 966a22c7032..57e67e9ef97 100644 --- a/testsuite/tests/typing-layouts-unboxed-records/recursive.ml +++ b/testsuite/tests/typing-layouts-unboxed-records/recursive.ml @@ -247,6 +247,20 @@ Error: Unboxed record element types must have a representable layout. (***************************************) (* Singleton recursive unboxed records *) +(* The check is conservative; we could allow this*) + +type 'a safe = #{ a : 'a } +type x = int safe safe +[%%expect{| +type 'a safe = #{ a : 'a; } +Line 2, characters 0-22: +2 | type x = int safe safe + ^^^^^^^^^^^^^^^^^^^^^^ +Error: The definition of "x" is recursive without boxing: + "x" = "int safe safe", + "int safe safe" contains "int safe" +|}] + (* We could allow these, as although they have unguarded recursion, they are finite size (thanks to the fact that we represent single-field records as the layout of the field rather than as a singleton product).