From 85b1d1d4dd4628d1fb8901c3280cde84da450bbe Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 25 Nov 2023 16:10:28 +0100 Subject: Rework `Vt` into `Engine` - Moves as much data out of the `Vm` - Removes duplication with call_vm and call_vt flavours - Uses tracked chain instead of fixed int for determining max nesting depth - This means that nesting checks now generalizes to layout and realization, to detect crashing show rules and overly nested layouts --- tests/typ/compiler/recursion.typ | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'tests/typ/compiler/recursion.typ') diff --git a/tests/typ/compiler/recursion.typ b/tests/typ/compiler/recursion.typ index 82da7245..461680ab 100644 --- a/tests/typ/compiler/recursion.typ +++ b/tests/typ/compiler/recursion.typ @@ -31,12 +31,41 @@ #let f = () => f #test(type(f()), int) +--- +// Test redefinition. +#let f(x) = "hello" +#let f(x) = if x != none { f(none) } else { "world" } +#test(f(1), "world") + --- // Error: 15-21 maximum function call depth exceeded #let rec(n) = rec(n) + 1 #rec(1) --- -#let f(x) = "hello" -#let f(x) = if x != none { f(none) } else { "world" } -#test(f(1), "world") +// Test cyclic imports during layout. +// Error: 2-38 maximum layout depth exceeded +// Hint: 2-38 try to reduce the amount of nesting in your layout +#layout(_ => include "recursion.typ") + +--- +// Test recursive show rules. +// Error: 22-25 maximum show rule depth exceeded +// Hint: 22-25 check whether the show rule matches its own output +// Hint: 22-25 this is a current compiler limitation that will be resolved in the future +#show math.equation: $x$ +$ x $ + +--- +// Error: 18-21 maximum show rule depth exceeded +// Hint: 18-21 check whether the show rule matches its own output +// Hint: 18-21 this is a current compiler limitation that will be resolved in the future +#show "hey": box[hey] +hey + +--- +// Error: 14-19 maximum show rule depth exceeded +// Hint: 14-19 check whether the show rule matches its own output +// Hint: 14-19 this is a current compiler limitation that will be resolved in the future +#show "hey": "hey" +hey -- cgit v1.2.3