• Håvard Haugen's avatar
    testing/quick: terminate for arbitrary recursive types · 74245b03
    Håvard Haugen authored
    Recursive types R containing slices of R's did not terminate despite the
    effort in CL 10821.
    
    For recursive types there was a competition between slice expansion by a
    factor 'complexSize', and termination with probability '1/complexSize'
    which lead to stack overflow as soon as a recursive struct had slices
    pointing to its own type.
    
    Fix this by shrinking the size hint as a function of recursion depth.
    This has the dual effect of reducing the number of elements generated
    per slice and also increasing the probability for termination.
    
    Fixes #11148.
    
    Change-Id: Ib61155b4f2e2de3873d508d63a1f4be759426d67
    Reviewed-on: https://go-review.googlesource.com/13830Reviewed-by: 's avatarAdam Langley <agl@golang.org>
    74245b03
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...