Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(assertions): stack overflow while parsing template (#26767)
Closes #26766 The function `findCycle` tries to find a cycle by using a depth-first search (DFS). The DFS is implemented recursively in the recurse function. For each node, it tries to find a path that eventually leads back to the start of the path. If such a path is found, a cycle exists, and the nodes forming this cycle are returned. One of the bugs in the current implementation is that it only checks whether the current dependency `dep` is equal to the first node of the current path `path[0]`. This means it will only detect a cycle if the cycle includes the first node of the search, which might not always be the case. To fix this, the function should check whether the current dependency `dep` is already somewhere in the current path `path`. If it is, then a cycle has been found. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information