Skip to content

Commit e608b98

Browse files
authored
Merge pull request #79772 from gottesmm/pr-9dc8d133c4df0ac75898153321c06dfee9f3416a
[DebuggingTheCompiler] Add a note about using -debug-cycles to debug request evaluator cycles.
2 parents 3addadc + 2973075 commit e608b98

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/DebuggingTheCompiler.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,26 @@ passing the flag `-Xfrontend -debug-constraints`:
219219
$ swift repl -Xfrontend -debug-constraints
220220
1> let foo = 1
221221

222+
### Debugging Evaluator Cycles
223+
224+
When triggering code in the type checker, one can by mistake cause a cycle in
225+
the request evaluator. The error looks as follows:
226+
227+
```
228+
<unknown>:0: error: circular reference
229+
file.swift:18:22: note: through reference here
230+
16 |
231+
17 | extension MyType {
232+
18 | public static func test() -> MyType { ... }
233+
| `- note: through reference here
234+
19 | }
235+
20 |
236+
```
237+
238+
To determine the actual circular request that is occuring, one can pass in the
239+
flag `-debug-cycles` to the compiler which will cause the compiler to dump out
240+
the linear chain of requests that led to the cycle.
241+
222242
## Debugging on SIL Level
223243

224244
### Options for Dumping the SIL

0 commit comments

Comments
 (0)