Skip to content

[DebuggingTheCompiler] Add a note about using -debug-cycles to debug request evaluator cycles. #79772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/DebuggingTheCompiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,26 @@ passing the flag `-Xfrontend -debug-constraints`:
$ swift repl -Xfrontend -debug-constraints
1> let foo = 1

### Debugging Evaluator Cycles

When triggering code in the type checker, one can by mistake cause a cycle in
the request evaluator. The error looks as follows:

```
<unknown>:0: error: circular reference
file.swift:18:22: note: through reference here
16 |
17 | extension MyType {
18 | public static func test() -> MyType { ... }
| `- note: through reference here
19 | }
20 |
```

To determine the actual circular request that is occuring, one can pass in the
flag `-debug-cycles` to the compiler which will cause the compiler to dump out
the linear chain of requests that led to the cycle.

## Debugging on SIL Level

### Options for Dumping the SIL
Expand Down