Bug in cycle detection reported in #95. Thank you @alingse. This issue is to track the bug itself as opposed to the fix. Description below copied from #95.
use visited map[visit]int to check cycle might get some bad case.
the key reason was that, all the pp, p printer share a same map[visit]int
but when we process a struct refer a pointer value twice or more, this is not a cycle, it's just a repeat refer.
maybe use other helper data type for every branch when we call code pp = *p statement
maybe a slice is enough to detect.
branch 1 : [v1, v2, v3, v5]
branch 2 : [v1, v2, v3, v4]
branch 3 : [v1, v2, v3, v4, v1]
only branch3 should print a "CYCLIC REFERENCE"
Bug in cycle detection reported in #95. Thank you @alingse. This issue is to track the bug itself as opposed to the fix. Description below copied from #95.
use
visited map[visit]intto check cycle might get some bad case.the key reason was that, all the
pp,pprintershare a samemap[visit]intbut when we process a struct refer a pointer value twice or more, this is not a cycle, it's just a repeat refer.
maybe use other helper data type for every branch when we call code
pp = *pstatementmaybe a
sliceis enough to detect.only branch3 should print a "CYCLIC REFERENCE"