internal/core/adt: add cycle detection
In some cases, when definitions mutually refer
to each other, the new typo check algorithm
could get stuck in a loop. The old algorithm
handled this differently (while computing the
sets).
This CL adds cycle detection by simply checking
that an ID that was initially checked isn't
checked again.
Test is added directly here as it caused as
stack overflow on its own.
Fixes #4006
Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I1ff0fa6b6927661e010ef1211ca95c242027472f
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1219239
Reviewed-by: 码畜生活 <likun_power@sina.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>